kingarnica commited on
Commit
29917e8
·
verified ·
1 Parent(s): 566ddf8

its not audio vizualizer its audio loops samples for producers

Browse files
Files changed (5) hide show
  1. components/navbar.js +4 -3
  2. index.html +66 -42
  3. packs.html +202 -0
  4. script.js +42 -129
  5. style.css +17 -19
components/navbar.js CHANGED
@@ -61,9 +61,10 @@ class AudioNavbar extends HTMLElement {
61
  EchoSphere
62
  </a>
63
  <div class="nav-links">
64
- <a href="/" class="nav-link">Home</a>
65
- <a href="/upload.html" class="nav-link">Upload</a>
66
- <a href="/library.html" class="nav-link">Library</a>
 
67
  <a href="https://github.com/kingoIII/Ruido1" target="_blank" rel="noopener noreferrer">
68
  <i data-feather="github" class="github-icon w-5 h-5 text-gray-400 hover:text-indigo-400 transition"></i>
69
  </a>
 
61
  EchoSphere
62
  </a>
63
  <div class="nav-links">
64
+ <a href="/" class="nav-link">Home</a>
65
+ <a href="/library.html" class="nav-link">Free Samples</a>
66
+ <a href="/packs.html" class="nav-link">Premium Packs</a>
67
+ <a href="/upload.html" class="nav-link">Sell Your Samples</a>
68
  <a href="https://github.com/kingoIII/Ruido1" target="_blank" rel="noopener noreferrer">
69
  <i data-feather="github" class="github-icon w-5 h-5 text-gray-400 hover:text-indigo-400 transition"></i>
70
  </a>
index.html CHANGED
@@ -14,60 +14,84 @@
14
 
15
  <main class="container mx-auto px-4 py-8">
16
  <div class="text-center mb-12">
17
- <h1 class="text-4xl md:text-6xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500">
18
- Ruido
19
- </h1>
20
- <p class="text-xl text-gray-400 max-w-2xl mx-auto">
21
- Discover and share your favorite music tracks with the world
22
- </p>
23
  </div>
24
-
25
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-12">
26
- <div class="bg-gray-800 rounded-2xl p-6 shadow-xl">
27
- <h2 class="text-2xl font-semibold mb-4">🎤 Live Audio Input</h2>
28
- <p class="text-gray-400 mb-6">Connect your microphone or audio device and watch the visualization respond in real-time.</p>
29
- <button id="startAudio" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-full transition">
30
- Start Listening
31
- </button>
32
- <div class="mt-8">
33
- <audio-visualizer type="circle"></audio-visualizer>
 
34
  </div>
35
  </div>
36
 
37
- <div class="bg-gray-800 rounded-2xl p-6 shadow-xl">
38
- <h2 class="text-2xl font-semibold mb-4">🎵 Audio File Upload</h2>
39
- <p class="text-gray-400 mb-6">Select an audio file from your device to visualize your favorite tracks.</p>
40
- <div class="mb-4">
41
- <input type="file" id="audioUpload" accept="audio/*" class="hidden">
42
- <label for="audioUpload" class="cursor-pointer bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-6 rounded-full inline-block transition">
43
- Choose File
44
- </label>
45
- <span id="fileName" class="ml-4 text-gray-400">No file selected</span>
 
46
  </div>
47
- <div class="mt-8">
48
- <audio-visualizer type="bars"></audio-visualizer>
 
 
 
 
 
 
 
 
 
 
49
  </div>
50
  </div>
51
  </div>
52
 
53
  <div class="bg-gray-800 rounded-2xl p-6 shadow-xl mb-12">
54
- <h2 class="text-2xl font-semibold mb-6">🎨 Visualization Styles</h2>
55
- <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
56
- <button class="visualizer-style bg-gray-700 hover:bg-gray-600 rounded-lg p-4 transition" data-type="bars">
57
- <i data-feather="bar-chart-2" class="w-8 h-8 mb-2"></i>
58
- <span>Frequency Bars</span>
59
- </button>
60
- <button class="visualizer-style bg-gray-700 hover:bg-gray-600 rounded-lg p-4 transition" data-type="wave">
61
- <i data-feather="activity" class="w-8 h-8 mb-2"></i>
62
- <span>Waveform</span>
63
- </button>
64
- <button class="visualizer-style bg-gray-700 hover:bg-gray-600 rounded-lg p-4 transition" data-type="circle">
65
- <i data-feather="circle" class="w-8 h-8 mb-2"></i>
66
- <span>Circle Spectrum</span>
67
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
68
  </div>
69
  </div>
70
- </main>
71
 
72
  <audio-footer></audio-footer>
73
 
 
14
 
15
  <main class="container mx-auto px-4 py-8">
16
  <div class="text-center mb-12">
17
+ <h1 class="text-4xl md:text-6xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500">
18
+ Ruido Samples
19
+ </h1>
20
+ <p class="text-xl text-gray-400 max-w-2xl mx-auto">
21
+ Premium royalty-free loops and samples for music producers
22
+ </p>
23
  </div>
24
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
25
+ <!-- Sample Pack 1 -->
26
+ <div class="bg-gray-800 rounded-xl p-6 shadow-lg hover:shadow-xl transition">
27
+ <img src="http://static.photos/music/640x360/1" alt="Drum Kit" class="w-full h-48 object-cover rounded-lg mb-4">
28
+ <h2 class="text-2xl font-semibold mb-2">Urban Drum Kit</h2>
29
+ <p class="text-gray-400 mb-4">120 premium drum one-shots and loops for hip-hop and trap production</p>
30
+ <div class="flex justify-between items-center">
31
+ <span class="text-indigo-400 font-medium">24.99€</span>
32
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-lg transition">
33
+ Preview
34
+ </button>
35
  </div>
36
  </div>
37
 
38
+ <!-- Sample Pack 2 -->
39
+ <div class="bg-gray-800 rounded-xl p-6 shadow-lg hover:shadow-xl transition">
40
+ <img src="http://static.photos/music/640x360/2" alt="Synth Pack" class="w-full h-48 object-cover rounded-lg mb-4">
41
+ <h2 class="text-2xl font-semibold mb-2">Analog Synth Essentials</h2>
42
+ <p class="text-gray-400 mb-4">80 vintage synth loops and one-shots for electronic music</p>
43
+ <div class="flex justify-between items-center">
44
+ <span class="text-indigo-400 font-medium">19.99€</span>
45
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-lg transition">
46
+ Preview
47
+ </button>
48
  </div>
49
+ </div>
50
+
51
+ <!-- Sample Pack 3 -->
52
+ <div class="bg-gray-800 rounded-xl p-6 shadow-lg hover:shadow-xl transition">
53
+ <img src="http://static.photos/music/640x360/3" alt="Vocal Pack" class="w-full h-48 object-cover rounded-lg mb-4">
54
+ <h2 class="text-2xl font-semibold mb-2">Soulful Vocals</h2>
55
+ <p class="text-gray-400 mb-4">50 R&B and soul vocal phrases and ad-libs</p>
56
+ <div class="flex justify-between items-center">
57
+ <span class="text-indigo-400 font-medium">29.99€</span>
58
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-lg transition">
59
+ Preview
60
+ </button>
61
  </div>
62
  </div>
63
  </div>
64
 
65
  <div class="bg-gray-800 rounded-2xl p-6 shadow-xl mb-12">
66
+ <h2 class="text-2xl font-semibold mb-6">🔥 Trending Free Samples</h2>
67
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
68
+ <div class="text-center">
69
+ <button class="w-full aspect-square bg-gray-700 hover:bg-gray-600 rounded-lg transition mb-2 flex items-center justify-center">
70
+ <i data-feather="play" class="w-6 h-6"></i>
71
+ </button>
72
+ <span class="text-sm">Trap Kick 01</span>
73
+ </div>
74
+ <div class="text-center">
75
+ <button class="w-full aspect-square bg-gray-700 hover:bg-gray-600 rounded-lg transition mb-2 flex items-center justify-center">
76
+ <i data-feather="play" class="w-6 h-6"></i>
77
+ </button>
78
+ <span class="text-sm">Synth Pluck</span>
79
+ </div>
80
+ <div class="text-center">
81
+ <button class="w-full aspect-square bg-gray-700 hover:bg-gray-600 rounded-lg transition mb-2 flex items-center justify-center">
82
+ <i data-feather="play" class="w-6 h-6"></i>
83
+ </button>
84
+ <span class="text-sm">Hi-Hat Roll</span>
85
+ </div>
86
+ <div class="text-center">
87
+ <button class="w-full aspect-square bg-gray-700 hover:bg-gray-600 rounded-lg transition mb-2 flex items-center justify-center">
88
+ <i data-feather="play" class="w-6 h-6"></i>
89
+ </button>
90
+ <span class="text-sm">Vocal Chop</span>
91
+ </div>
92
  </div>
93
  </div>
94
+ </main>
95
 
96
  <audio-footer></audio-footer>
97
 
packs.html ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Premium Sample Packs | Ruido</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ </head>
11
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
12
+ <audio-navbar></audio-navbar>
13
+
14
+ <main class="container mx-auto px-4 py-8">
15
+ <div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8 gap-4">
16
+ <div>
17
+ <h1 class="text-3xl md:text-5xl font-bold mb-2 bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500">
18
+ Premium Sample Packs
19
+ </h1>
20
+ <p class="text-gray-400">High-quality curated collections for professional producers</p>
21
+ </div>
22
+
23
+ <div class="flex gap-3">
24
+ <div class="relative">
25
+ <select class="bg-gray-800 border border-gray-700 rounded-full py-2 pl-4 pr-8 text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 appearance-none">
26
+ <option>All Categories</option>
27
+ <option>Drums</option>
28
+ <option>Melodic</option>
29
+ <option>Vocals</option>
30
+ <option>FX</option>
31
+ </select>
32
+ <i data-feather="chevron-down" class="absolute right-3 top-2.5 text-gray-400 pointer-events-none"></i>
33
+ </div>
34
+ <div class="relative">
35
+ <select class="bg-gray-800 border border-gray-700 rounded-full py-2 pl-4 pr-8 text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 appearance-none">
36
+ <option>Sort By</option>
37
+ <option>Popular</option>
38
+ <option>Newest</option>
39
+ <option>Price: Low to High</option>
40
+ <option>Price: High to Low</option>
41
+ </select>
42
+ <i data-feather="chevron-down" class="absolute right-3 top-2.5 text-gray-400 pointer-events-none"></i>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
48
+ <!-- Sample Pack Card -->
49
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:shadow-xl transition">
50
+ <div class="relative group">
51
+ <img src="http://static.photos/music/640x360/6" alt="Sample Pack" class="w-full h-48 object-cover">
52
+ <button class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition bg-black bg-opacity-50">
53
+ <div class="bg-indigo-600 rounded-full p-3">
54
+ <i data-feather="play" class="w-6 h-6"></i>
55
+ </div>
56
+ </button>
57
+ </div>
58
+ <div class="p-4">
59
+ <div class="flex justify-between items-start">
60
+ <div>
61
+ <h3 class="font-semibold text-lg">Lo-Fi Essentials</h3>
62
+ <p class="text-gray-400 text-sm">120 samples • 24-bit WAV</p>
63
+ </div>
64
+ <span class="text-indigo-400 font-medium">29.99€</span>
65
+ </div>
66
+ <div class="mt-4 flex justify-between items-center">
67
+ <div class="flex items-center text-yellow-400">
68
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
69
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
70
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
71
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
72
+ <i data-feather="star" class="w-4 h-4"></i>
73
+ <span class="text-gray-400 text-sm ml-1">(42)</span>
74
+ </div>
75
+ <button class="text-gray-400 hover:text-indigo-400">
76
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
77
+ </button>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <!-- Repeat similar cards for other sample packs -->
83
+ <!-- Sample Pack 2 -->
84
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:shadow-xl transition">
85
+ <div class="relative group">
86
+ <img src="http://static.photos/music/640x360/7" alt="Sample Pack" class="w-full h-48 object-cover">
87
+ <button class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition bg-black bg-opacity-50">
88
+ <div class="bg-indigo-600 rounded-full p-3">
89
+ <i data-feather="play" class="w-6 h-6"></i>
90
+ </div>
91
+ </button>
92
+ </div>
93
+ <div class="p-4">
94
+ <div class="flex justify-between items-start">
95
+ <div>
96
+ <h3 class="font-semibold text-lg">Trap Drums Vol. 3</h3>
97
+ <p class="text-gray-400 text-sm">85 samples • 24-bit WAV</p>
98
+ </div>
99
+ <span class="text-indigo-400 font-medium">24.99€</span>
100
+ </div>
101
+ <div class="mt-4 flex justify-between items-center">
102
+ <div class="flex items-center text-yellow-400">
103
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
104
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
105
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
106
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
107
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
108
+ <span class="text-gray-400 text-sm ml-1">(112)</span>
109
+ </div>
110
+ <button class="text-gray-400 hover:text-indigo-400">
111
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
112
+ </button>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- Sample Pack 3 -->
118
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:shadow-xl transition">
119
+ <div class="relative group">
120
+ <img src="http://static.photos/music/640x360/8" alt="Sample Pack" class="w-full h-48 object-cover">
121
+ <button class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition bg-black bg-opacity-50">
122
+ <div class="bg-indigo-600 rounded-full p-3">
123
+ <i data-feather="play" class="w-6 h-6"></i>
124
+ </div>
125
+ </button>
126
+ </div>
127
+ <div class="p-4">
128
+ <div class="flex justify-between items-start">
129
+ <div>
130
+ <h3 class="font-semibold text-lg">Vintage Keys</h3>
131
+ <p class="text-gray-400 text-sm">60 loops • 24-bit WAV</p>
132
+ </div>
133
+ <span class="text-indigo-400 font-medium">19.99€</span>
134
+ </div>
135
+ <div class="mt-4 flex justify-between items-center">
136
+ <div class="flex items-center text-yellow-400">
137
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
138
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
139
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
140
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
141
+ <i data-feather="star" class="w-4 h-4"></i>
142
+ <span class="text-gray-400 text-sm ml-1">(28)</span>
143
+ </div>
144
+ <button class="text-gray-400 hover:text-indigo-400">
145
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
146
+ </button>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ <!-- Sample Pack 4 -->
152
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:shadow-xl transition">
153
+ <div class="relative group">
154
+ <img src="http://static.photos/music/640x360/9" alt="Sample Pack" class="w-full h-48 object-cover">
155
+ <button class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition bg-black bg-opacity-50">
156
+ <div class="bg-indigo-600 rounded-full p-3">
157
+ <i data-feather="play" class="w-6 h-6"></i>
158
+ </div>
159
+ </button>
160
+ </div>
161
+ <div class="p-4">
162
+ <div class="flex justify-between items-start">
163
+ <div>
164
+ <h3 class="font-semibold text-lg">Ambient Textures</h3>
165
+ <p class="text-gray-400 text-sm">45 samples • 24-bit WAV</p>
166
+ </div>
167
+ <span class="text-indigo-400 font-medium">22.99€</span>
168
+ </div>
169
+ <div class="mt-4 flex justify-between items-center">
170
+ <div class="flex items-center text-yellow-400">
171
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
172
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
173
+ <i data-feather="star" class="w-4 h-4 fill-current"></i>
174
+ <i data-feather="star" class="w-4 h-4"></i>
175
+ <i data-feather="star" class="w-4 h-4"></i>
176
+ <span class="text-gray-400 text-sm ml-1">(15)</span>
177
+ </div>
178
+ <button class="text-gray-400 hover:text-indigo-400">
179
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
180
+ </button>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
186
+ <div class="mt-10 flex justify-center">
187
+ <button class="px-6 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-full font-medium transition border border-gray-700">
188
+ Load More Packs
189
+ </button>
190
+ </div>
191
+ </main>
192
+
193
+ <audio-footer></audio-footer>
194
+
195
+ <script src="components/navbar.js"></script>
196
+ <script src="components/footer.js"></script>
197
+ <script src="script.js"></script>
198
+ <script>
199
+ feather.replace();
200
+ </script>
201
+ </body>
202
+ </html>
script.js CHANGED
@@ -1,135 +1,48 @@
 
1
  document.addEventListener('DOMContentLoaded', () => {
2
- // Audio context setup
3
- let audioContext;
4
- let analyser;
5
- let audioSource;
6
- let isPlaying = false;
7
- let activeVisualizerType = 'bars';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- // DOM elements
10
- const startAudioBtn = document.getElementById('startAudio');
11
- const audioUpload = document.getElementById('audioUpload');
12
- const fileNameSpan = document.getElementById('fileName');
13
- const visualizerStyles = document.querySelectorAll('.visualizer-style');
14
-
15
- // Initialize audio context on user interaction
16
- startAudioBtn.addEventListener('click', toggleAudioInput);
17
- audioUpload.addEventListener('change', handleFileUpload);
18
-
19
- // Visualizer style selector
20
- visualizerStyles.forEach(style => {
21
- style.addEventListener('click', () => {
22
- visualizerStyles.forEach(s => s.classList.remove('ring-2', 'ring-indigo-500'));
23
- style.classList.add('ring-2', 'ring-indigo-500');
24
- activeVisualizerType = style.dataset.type;
25
- document.querySelectorAll('audio-visualizer').forEach(viz => {
26
- viz.setAttribute('type', activeVisualizerType);
27
- });
28
  });
29
  });
30
-
31
- // Set default visualizer style
32
- visualizerStyles[0].click();
33
-
34
- async function toggleAudioInput() {
35
- try {
36
- if (!isPlaying) {
37
- await setupAudioContext();
38
- startAudioBtn.textContent = 'Stop Listening';
39
- startAudioBtn.classList.remove('bg-indigo-600', 'hover:bg-indigo-700');
40
- startAudioBtn.classList.add('bg-pink-600', 'hover:bg-pink-700', 'pulse');
41
- isPlaying = true;
42
- } else {
43
- stopAudio();
44
- startAudioBtn.textContent = 'Start Listening';
45
- startAudioBtn.classList.remove('bg-pink-600', 'hover:bg-pink-700', 'pulse');
46
- startAudioBtn.classList.add('bg-indigo-600', 'hover:bg-indigo-700');
47
- isPlaying = false;
48
- }
49
- } catch (error) {
50
- console.error('Error accessing microphone:', error);
51
- alert('Could not access microphone. Please check permissions.');
52
- }
53
- }
54
-
55
- async function setupAudioContext() {
56
- if (!audioContext) {
57
- audioContext = new (window.AudioContext || window.webkitAudioContext)();
58
- analyser = audioContext.createAnalyser();
59
- analyser.fftSize = 256;
60
-
61
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
62
- audioSource = audioContext.createMediaStreamSource(stream);
63
- audioSource.connect(analyser);
64
-
65
- // Connect all visualizers to this analyser
66
- document.querySelectorAll('audio-visualizer').forEach(viz => {
67
- viz.setAnalyser(analyser);
68
- viz.startVisualization();
69
- });
70
- }
71
- }
72
-
73
- function stopAudio() {
74
- if (audioSource && audioSource.mediaStream) {
75
- audioSource.mediaStream.getTracks().forEach(track => track.stop());
76
- }
77
- if (audioContext) {
78
- document.querySelectorAll('audio-visualizer').forEach(viz => {
79
- viz.stopVisualization();
80
- });
81
- // Don't close the context to avoid re-creating it
82
- }
83
- }
84
-
85
- function handleFileUpload(e) {
86
- const file = e.target.files[0];
87
- if (!file) return;
88
-
89
- fileNameSpan.textContent = file.name;
90
-
91
- if (audioContext) {
92
- stopAudio();
93
- isPlaying = false;
94
- startAudioBtn.textContent = 'Start Listening';
95
- startAudioBtn.classList.remove('bg-pink-600', 'hover:bg-pink-700', 'pulse');
96
- startAudioBtn.classList.add('bg-indigo-600', 'hover:bg-indigo-700');
97
- }
98
-
99
- const reader = new FileReader();
100
- reader.onload = function(e) {
101
- const arrayBuffer = e.target.result;
102
- processAudioFile(arrayBuffer);
103
- };
104
- reader.readAsArrayBuffer(file);
105
- }
106
-
107
- function processAudioFile(arrayBuffer) {
108
- if (!audioContext) {
109
- audioContext = new (window.AudioContext || window.webkitAudioContext)();
110
- analyser = audioContext.createAnalyser();
111
- analyser.fftSize = 256;
112
- }
113
-
114
- audioContext.decodeAudioData(arrayBuffer, function(buffer) {
115
- if (audioSource) {
116
- audioSource.disconnect();
117
- }
118
-
119
- audioSource = audioContext.createBufferSource();
120
- audioSource.buffer = buffer;
121
- audioSource.connect(analyser);
122
- audioSource.connect(audioContext.destination);
123
- audioSource.start();
124
-
125
- isPlaying = true;
126
- document.querySelectorAll('audio-visualizer').forEach(viz => {
127
- viz.setAnalyser(analyser);
128
- viz.startVisualization();
129
- });
130
- }, function(e) {
131
- console.error('Error decoding audio file:', e);
132
- alert('Error loading audio file. Please try another file.');
133
  });
134
- }
135
  });
 
1
+
2
  document.addEventListener('DOMContentLoaded', () => {
3
+ // Sample player functionality
4
+ const samplePlayers = document.querySelectorAll('.sample-player');
5
+
6
+ samplePlayers.forEach(player => {
7
+ player.addEventListener('click', function() {
8
+ const audio = this.querySelector('audio');
9
+ if (audio) {
10
+ if (audio.paused) {
11
+ // Pause all other samples
12
+ document.querySelectorAll('audio').forEach(a => {
13
+ if (a !== audio) a.pause();
14
+ });
15
+ audio.currentTime = 0;
16
+ audio.play();
17
+ this.classList.add('playing');
18
+ } else {
19
+ audio.pause();
20
+ this.classList.remove('playing');
21
+ }
22
+ }
23
+ });
24
+ });
25
 
26
+ // Update audio elements when they end
27
+ document.querySelectorAll('audio').forEach(audio => {
28
+ audio.addEventListener('ended', function() {
29
+ const player = this.closest('.sample-player');
30
+ if (player) player.classList.remove('playing');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  });
32
  });
33
+ // Shopping cart functionality
34
+ const cartButtons = document.querySelectorAll('.add-to-cart');
35
+
36
+ cartButtons.forEach(button => {
37
+ button.addEventListener('click', function() {
38
+ const packId = this.dataset.packId;
39
+ // In a real app, you would add to cart via API
40
+ this.innerHTML = '<i data-feather="check" class="w-4 h-4"></i> Added';
41
+ feather.replace();
42
+ setTimeout(() => {
43
+ this.innerHTML = '<i data-feather="shopping-cart" class="w-4 h-4"></i>';
44
+ feather.replace();
45
+ }, 2000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  });
47
+ });
48
  });
style.css CHANGED
@@ -2,30 +2,28 @@
2
  body {
3
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
4
  }
 
 
 
 
 
5
 
6
- /* Visualizer canvas styles */
7
- audio-visualizer {
8
- display: block;
9
- width: 100%;
10
- height: 300px;
11
- background: linear-gradient(135deg, rgba(30, 27, 75, 0.5) 0%, rgba(11, 11, 25, 0.7) 100%);
12
- border-radius: 12px;
13
- transition: all 0.3s ease;
14
  }
15
 
16
- /* Static visualizer styling for gallery */
17
- audio-visualizer[static] {
18
- pointer-events: none;
19
- animation: visualizerDemo 4s infinite alternate;
20
  }
21
 
22
- @keyframes visualizerDemo {
23
- 0%, 100% {
24
- filter: hue-rotate(0deg);
25
- }
26
- 50% {
27
- filter: hue-rotate(45deg);
28
- }
 
29
  }
30
  /* Pulse animation for active buttons */
31
  @keyframes pulse {
 
2
  body {
3
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
4
  }
5
+ /* Sample player styles */
6
+ .sample-player {
7
+ transition: all 0.2s ease;
8
+ cursor: pointer;
9
+ }
10
 
11
+ .sample-player:hover {
12
+ transform: scale(1.02);
 
 
 
 
 
 
13
  }
14
 
15
+ .sample-player.playing {
16
+ box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
 
 
17
  }
18
 
19
+ /* Pack card hover effects */
20
+ .pack-card {
21
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
22
+ }
23
+
24
+ .pack-card:hover {
25
+ transform: translateY(-5px);
26
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
27
  }
28
  /* Pulse animation for active buttons */
29
  @keyframes pulse {