Assad3l commited on
Commit
aba68f0
·
verified ·
1 Parent(s): 20a6bc5

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +523 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ebala
3
- emoji: 📚
4
- colorFrom: purple
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ebala
3
+ emoji: 🐳
4
+ colorFrom: blue
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,523 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FruitLoop Sound Machine</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes pulse {
11
+ 0% { transform: scale(1); }
12
+ 50% { transform: scale(1.1); }
13
+ 100% { transform: scale(1); }
14
+ }
15
+ .pulse {
16
+ animation: pulse 0.5s ease-in-out;
17
+ }
18
+ .fruit-btn {
19
+ transition: all 0.2s ease;
20
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
21
+ }
22
+ .fruit-btn:hover {
23
+ transform: translateY(-3px);
24
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
25
+ }
26
+ .fruit-btn:active {
27
+ transform: translateY(1px);
28
+ }
29
+ .knob {
30
+ width: 50px;
31
+ height: 50px;
32
+ border-radius: 50%;
33
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
34
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
35
+ position: relative;
36
+ cursor: pointer;
37
+ }
38
+ .knob:after {
39
+ content: '';
40
+ position: absolute;
41
+ width: 5px;
42
+ height: 15px;
43
+ background: #e74c3c;
44
+ top: 5px;
45
+ left: 50%;
46
+ transform: translateX(-50%);
47
+ border-radius: 3px;
48
+ }
49
+ .slider {
50
+ -webkit-appearance: none;
51
+ width: 100%;
52
+ height: 10px;
53
+ border-radius: 5px;
54
+ background: linear-gradient(to right, #f39c12, #e74c3c);
55
+ outline: none;
56
+ }
57
+ .slider::-webkit-slider-thumb {
58
+ -webkit-appearance: none;
59
+ appearance: none;
60
+ width: 20px;
61
+ height: 20px;
62
+ border-radius: 50%;
63
+ background: #fff;
64
+ cursor: pointer;
65
+ box-shadow: 0 0 5px rgba(0,0,0,0.3);
66
+ }
67
+ .visualizer {
68
+ height: 100px;
69
+ background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
70
+ border-radius: 5px;
71
+ position: relative;
72
+ overflow: hidden;
73
+ }
74
+ .bar {
75
+ position: absolute;
76
+ bottom: 0;
77
+ width: 5px;
78
+ background: linear-gradient(to top, #f39c12, #e74c3c);
79
+ border-radius: 3px 3px 0 0;
80
+ }
81
+ </style>
82
+ </head>
83
+ <body class="bg-gradient-to-br from-purple-900 to-indigo-800 min-h-screen text-white p-6">
84
+ <div class="max-w-4xl mx-auto">
85
+ <header class="text-center mb-8">
86
+ <h1 class="text-4xl font-bold mb-2 text-transparent bg-clip-text bg-gradient-to-r from-yellow-400 to-pink-500">
87
+ <i class="fas fa-music mr-2"></i>FruitLoop Sound Machine
88
+ </h1>
89
+ <p class="text-lg text-purple-200">Create funky beats with fruity sounds!</p>
90
+ </header>
91
+
92
+ <div class="bg-gray-900 bg-opacity-70 rounded-xl p-6 shadow-2xl border border-purple-500 border-opacity-30">
93
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
94
+ <!-- Fruit Sound Buttons -->
95
+ <button class="fruit-btn bg-gradient-to-br from-red-500 to-pink-600 rounded-lg p-4 flex flex-col items-center justify-center h-32"
96
+ data-sound="apple" onclick="playSound('apple')">
97
+ <i class="fas fa-apple-alt text-4xl mb-2"></i>
98
+ <span class="font-bold">Apple</span>
99
+ </button>
100
+ <button class="fruit-btn bg-gradient-to-br from-yellow-500 to-orange-500 rounded-lg p-4 flex flex-col items-center justify-center h-32"
101
+ data-sound="banana" onclick="playSound('banana')">
102
+ <i class="fas fa-banana text-4xl mb-2"></i>
103
+ <span class="font-bold">Banana</span>
104
+ </button>
105
+ <button class="fruit-btn bg-gradient-to-br from-green-500 to-lime-400 rounded-lg p-4 flex flex-col items-center justify-center h-32"
106
+ data-sound="watermelon" onclick="playSound('watermelon')">
107
+ <i class="fas fa-watermelon text-4xl mb-2"></i>
108
+ <span class="font-bold">Melon</span>
109
+ </button>
110
+ <button class="fruit-btn bg-gradient-to-br from-purple-500 to-indigo-500 rounded-lg p-4 flex flex-col items-center justify-center h-32"
111
+ data-sound="grape" onclick="playSound('grape')">
112
+ <i class="fas fa-grapes text-4xl mb-2"></i>
113
+ <span class="font-bold">Grape</span>
114
+ </button>
115
+ <button class="fruit-btn bg-gradient-to-br from-orange-500 to-red-500 rounded-lg p-4 flex flex-col items-center justify-center h-32"
116
+ data-sound="orange" onclick="playSound('orange')">
117
+ <i class="fas fa-orange text-4xl mb-2"></i>
118
+ <span class="font-bold">Orange</span>
119
+ </button>
120
+ <button class="fruit-btn bg-gradient-to-br from-pink-500 to-red-400 rounded-lg p-4 flex flex-col items-center justify-center h-32"
121
+ data-sound="strawberry" onclick="playSound('strawberry')">
122
+ <i class="fas fa-strawberry text-4xl mb-2"></i>
123
+ <span class="font-bold">Strawberry</span>
124
+ </button>
125
+ <button class="fruit-btn bg-gradient-to-br from-blue-400 to-blue-600 rounded-lg p-4 flex flex-col items-center justify-center h-32"
126
+ data-sound="blueberry" onclick="playSound('blueberry')">
127
+ <i class="fas fa-berry text-4xl mb-2"></i>
128
+ <span class="font-bold">Blueberry</span>
129
+ </button>
130
+ <button class="fruit-btn bg-gradient-to-br from-yellow-400 to-yellow-600 rounded-lg p-4 flex flex-col items-center justify-center h-32"
131
+ data-sound="lemon" onclick="playSound('lemon')">
132
+ <i class="fas fa-lemon text-4xl mb-2"></i>
133
+ <span class="font-bold">Lemon</span>
134
+ </button>
135
+ </div>
136
+
137
+ <!-- Controls -->
138
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
139
+ <div class="bg-gray-800 bg-opacity-50 p-4 rounded-lg">
140
+ <h3 class="text-lg font-semibold mb-3 text-center text-yellow-300">
141
+ <i class="fas fa-sliders-h mr-2"></i>Sound Controls
142
+ </h3>
143
+ <div class="space-y-4">
144
+ <div>
145
+ <label class="block mb-1 text-sm">Volume</label>
146
+ <input type="range" min="0" max="1" step="0.01" value="0.7"
147
+ class="slider" id="volumeSlider" oninput="updateVolume()">
148
+ </div>
149
+ <div>
150
+ <label class="block mb-1 text-sm">Playback Rate</label>
151
+ <input type="range" min="0.5" max="2" step="0.1" value="1"
152
+ class="slider" id="rateSlider" oninput="updateRate()">
153
+ </div>
154
+ <div>
155
+ <label class="block mb-1 text-sm">Filter Frequency</label>
156
+ <input type="range" min="20" max="20000" step="10" value="20000"
157
+ class="slider" id="filterSlider" oninput="updateFilter()">
158
+ </div>
159
+ </div>
160
+ </div>
161
+
162
+ <div class="bg-gray-800 bg-opacity-50 p-4 rounded-lg">
163
+ <h3 class="text-lg font-semibold mb-3 text-center text-green-300">
164
+ <i class="fas fa-random mr-2"></i>Effects
165
+ </h3>
166
+ <div class="space-y-4">
167
+ <div>
168
+ <label class="block mb-1 text-sm">Reverb</label>
169
+ <input type="range" min="0" max="1" step="0.1" value="0"
170
+ class="slider" id="reverbSlider" oninput="updateReverb()">
171
+ </div>
172
+ <div>
173
+ <label class="block mb-1 text-sm">Delay</label>
174
+ <input type="range" min="0" max="1" step="0.1" value="0"
175
+ class="slider" id="delaySlider" oninput="updateDelay()">
176
+ </div>
177
+ <div>
178
+ <label class="block mb-1 text-sm">Distortion</label>
179
+ <input type="range" min="0" max="1" step="0.1" value="0"
180
+ class="slider" id="distortionSlider" oninput="updateDistortion()">
181
+ </div>
182
+ </div>
183
+ </div>
184
+
185
+ <div class="bg-gray-800 bg-opacity-50 p-4 rounded-lg">
186
+ <h3 class="text-lg font-semibold mb-3 text-center text-blue-300">
187
+ <i class="fas fa-wave-square mr-2"></i>Visualizer
188
+ </h3>
189
+ <div class="visualizer" id="visualizer">
190
+ <!-- Bars will be added dynamically -->
191
+ </div>
192
+ <div class="mt-4 flex justify-center">
193
+ <button onclick="toggleVisualizer()" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg transition">
194
+ <i class="fas fa-play mr-2"></i>Toggle Visualizer
195
+ </button>
196
+ </div>
197
+ </div>
198
+ </div>
199
+
200
+ <!-- Sequencer -->
201
+ <div class="bg-gray-800 bg-opacity-50 p-4 rounded-lg mb-6">
202
+ <h3 class="text-lg font-semibold mb-3 text-center text-purple-300">
203
+ <i class="fas fa-drum mr-2"></i>Fruit Sequencer
204
+ </h3>
205
+ <div class="overflow-x-auto">
206
+ <table class="w-full">
207
+ <thead>
208
+ <tr>
209
+ <th class="px-2 py-1 text-sm">Fruit</th>
210
+ <th class="px-2 py-1 text-sm">Steps</th>
211
+ </tr>
212
+ </thead>
213
+ <tbody>
214
+ <tr>
215
+ <td class="px-2 py-1 text-center">🍎</td>
216
+ <td class="px-2 py-1">
217
+ <div class="flex space-x-1">
218
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="1">
219
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="2">
220
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="3">
221
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="4">
222
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="5">
223
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="6">
224
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="7">
225
+ <input type="checkbox" class="step-checkbox" data-sound="apple" data-step="8">
226
+ </div>
227
+ </td>
228
+ </tr>
229
+ <tr class="bg-gray-700 bg-opacity-30">
230
+ <td class="px-2 py-1 text-center">🍌</td>
231
+ <td class="px-2 py-1">
232
+ <div class="flex space-x-1">
233
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="1">
234
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="2">
235
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="3">
236
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="4">
237
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="5">
238
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="6">
239
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="7">
240
+ <input type="checkbox" class="step-checkbox" data-sound="banana" data-step="8">
241
+ </div>
242
+ </td>
243
+ </tr>
244
+ <tr>
245
+ <td class="px-2 py-1 text-center">🍉</td>
246
+ <td class="px-2 py-1">
247
+ <div class="flex space-x-1">
248
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="1">
249
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="2">
250
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="3">
251
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="4">
252
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="5">
253
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="6">
254
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="7">
255
+ <input type="checkbox" class="step-checkbox" data-sound="watermelon" data-step="8">
256
+ </div>
257
+ </td>
258
+ </tr>
259
+ </tbody>
260
+ </table>
261
+ </div>
262
+ <div class="mt-4 flex justify-center space-x-4">
263
+ <button onclick="startSequencer()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg transition">
264
+ <i class="fas fa-play mr-2"></i>Start
265
+ </button>
266
+ <button onclick="stopSequencer()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-lg transition">
267
+ <i class="fas fa-stop mr-2"></i>Stop
268
+ </button>
269
+ <button onclick="randomizeSequencer()" class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-lg transition">
270
+ <i class="fas fa-random mr-2"></i>Randomize
271
+ </button>
272
+ </div>
273
+ </div>
274
+ </div>
275
+
276
+ <footer class="text-center mt-8 text-purple-300 text-sm">
277
+ <p>Made with <i class="fas fa-heart text-red-400"></i> for music lovers | FruitLoop Sound Machine © 2023</p>
278
+ </footer>
279
+ </div>
280
+
281
+ <script>
282
+ // Audio context and nodes
283
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
284
+ let sounds = {};
285
+ let gainNode = audioContext.createGain();
286
+ let filterNode = audioContext.createBiquadFilter();
287
+ let convolverNode = audioContext.createConvolver();
288
+ let delayNode = audioContext.createDelay();
289
+ let feedbackNode = audioContext.createGain();
290
+ let distortionNode = audioContext.createWaveShaper();
291
+
292
+ // Connect nodes
293
+ gainNode.connect(filterNode);
294
+ filterNode.connect(distortionNode);
295
+ distortionNode.connect(delayNode);
296
+ delayNode.connect(feedbackNode);
297
+ feedbackNode.connect(delayNode);
298
+ delayNode.connect(convolverNode);
299
+ convolverNode.connect(audioContext.destination);
300
+
301
+ // Set initial values
302
+ gainNode.gain.value = 0.7;
303
+ filterNode.type = "lowpass";
304
+ filterNode.frequency.value = 20000;
305
+ feedbackNode.gain.value = 0;
306
+ delayNode.delayTime.value = 0.5;
307
+
308
+ // Create distortion curve
309
+ function makeDistortionCurve(amount) {
310
+ const k = typeof amount === 'number' ? amount : 50;
311
+ const n_samples = 44100;
312
+ const curve = new Float32Array(n_samples);
313
+ const deg = Math.PI / 180;
314
+
315
+ for (let i = 0; i < n_samples; i++) {
316
+ const x = (i * 2) / n_samples - 1;
317
+ curve[i] = ((3 + k) * x * 20 * deg) / (Math.PI + k * Math.abs(x));
318
+ }
319
+ return curve;
320
+ }
321
+
322
+ // Load sounds
323
+ const soundFiles = {
324
+ apple: 'https://assets.mixkit.co/sfx/preview/mixkit-arcade-game-jump-coin-216.mp3',
325
+ banana: 'https://assets.mixkit.co/sfx/preview/mixkit-unlock-game-notification-253.mp3',
326
+ watermelon: 'https://assets.mixkit.co/sfx/preview/mixkit-achievement-bell-600.mp3',
327
+ grape: 'https://assets.mixkit.co/sfx/preview/mixkit-arcade-retro-game-over-213.mp3',
328
+ orange: 'https://assets.mixkit.co/sfx/preview/mixkit-arcade-mechanical-bling-210.mp3',
329
+ strawberry: 'https://assets.mixkit.co/sfx/preview/mixkit-bonus-earned-in-video-game-2058.mp3',
330
+ blueberry: 'https://assets.mixkit.co/sfx/preview/mixkit-extra-bonus-points-arcade-2043.mp3',
331
+ lemon: 'https://assets.mixkit.co/sfx/preview/mixkit-arcade-video-game-bonus-2044.mp3'
332
+ };
333
+
334
+ // Load all sounds
335
+ function loadSounds() {
336
+ Object.keys(soundFiles).forEach(key => {
337
+ fetch(soundFiles[key])
338
+ .then(response => response.arrayBuffer())
339
+ .then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer))
340
+ .then(audioBuffer => {
341
+ sounds[key] = audioBuffer;
342
+ })
343
+ .catch(error => {
344
+ console.error('Error loading sound:', key, error);
345
+ });
346
+ });
347
+ }
348
+
349
+ // Play sound function
350
+ function playSound(soundName) {
351
+ if (!sounds[soundName]) return;
352
+
353
+ const source = audioContext.createBufferSource();
354
+ source.buffer = sounds[soundName];
355
+ source.playbackRate.value = parseFloat(document.getElementById('rateSlider').value);
356
+
357
+ source.connect(gainNode);
358
+ source.start();
359
+
360
+ // Add pulse animation to button
361
+ const button = document.querySelector(`[data-sound="${soundName}"]`);
362
+ button.classList.add('pulse');
363
+ setTimeout(() => button.classList.remove('pulse'), 500);
364
+
365
+ // Visualizer effect
366
+ if (visualizerActive) {
367
+ triggerVisualizer();
368
+ }
369
+ }
370
+
371
+ // Control functions
372
+ function updateVolume() {
373
+ gainNode.gain.value = parseFloat(document.getElementById('volumeSlider').value);
374
+ }
375
+
376
+ function updateRate() {
377
+ // This will be applied when sounds are played
378
+ }
379
+
380
+ function updateFilter() {
381
+ filterNode.frequency.value = parseFloat(document.getElementById('filterSlider').value);
382
+ }
383
+
384
+ function updateReverb() {
385
+ const amount = parseFloat(document.getElementById('reverbSlider').value);
386
+ if (amount > 0) {
387
+ // Create a simple impulse response for reverb
388
+ const length = audioContext.sampleRate * 2;
389
+ const impulse = audioContext.createBuffer(2, length, audioContext.sampleRate);
390
+ const left = impulse.getChannelData(0);
391
+ const right = impulse.getChannelData(1);
392
+
393
+ for (let i = 0; i < length; i++) {
394
+ const n = length - i;
395
+ left[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / length, amount * 10);
396
+ right[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / length, amount * 10);
397
+ }
398
+
399
+ convolverNode.buffer = impulse;
400
+ } else {
401
+ // Bypass reverb
402
+ convolverNode.buffer = null;
403
+ }
404
+ }
405
+
406
+ function updateDelay() {
407
+ const amount = parseFloat(document.getElementById('delaySlider').value);
408
+ feedbackNode.gain.value = amount * 0.8;
409
+ delayNode.delayTime.value = amount * 0.5;
410
+ }
411
+
412
+ function updateDistortion() {
413
+ const amount = parseFloat(document.getElementById('distortionSlider').value);
414
+ distortionNode.curve = makeDistortionCurve(amount * 100);
415
+ distortionNode.oversample = amount > 0.5 ? '4x' : 'none';
416
+ }
417
+
418
+ // Visualizer
419
+ let visualizerActive = false;
420
+ let bars = [];
421
+
422
+ function initVisualizer() {
423
+ const visualizer = document.getElementById('visualizer');
424
+ visualizer.innerHTML = '';
425
+ bars = [];
426
+
427
+ for (let i = 0; i < 32; i++) {
428
+ const bar = document.createElement('div');
429
+ bar.className = 'bar';
430
+ bar.style.left = `${i * 6}px`;
431
+ bar.style.height = '0px';
432
+ visualizer.appendChild(bar);
433
+ bars.push(bar);
434
+ }
435
+ }
436
+
437
+ function triggerVisualizer() {
438
+ for (let i = 0; i < bars.length; i++) {
439
+ const randomHeight = Math.random() * 80 + 20;
440
+ bars[i].style.height = `${randomHeight}px`;
441
+ bars[i].style.transition = 'height 0.1s ease-out';
442
+
443
+ setTimeout(() => {
444
+ bars[i].style.height = '0px';
445
+ bars[i].style.transition = 'height 0.3s ease-out';
446
+ }, 100);
447
+ }
448
+ }
449
+
450
+ function toggleVisualizer() {
451
+ visualizerActive = !visualizerActive;
452
+ if (visualizerActive) {
453
+ initVisualizer();
454
+ }
455
+ }
456
+
457
+ // Sequencer
458
+ let sequencerInterval;
459
+ let currentStep = 0;
460
+
461
+ function startSequencer() {
462
+ if (sequencerInterval) clearInterval(sequencerInterval);
463
+
464
+ const bpm = 120;
465
+ const stepDuration = (60 / bpm) / 2; // 8th notes
466
+
467
+ sequencerInterval = setInterval(() => {
468
+ currentStep = (currentStep % 8) + 1;
469
+
470
+ // Highlight current step
471
+ document.querySelectorAll('.step-checkbox').forEach(checkbox => {
472
+ checkbox.parentElement.style.backgroundColor =
473
+ parseInt(checkbox.dataset.step) === currentStep ? 'rgba(255, 255, 255, 0.2)' : '';
474
+ });
475
+
476
+ // Play sounds for current step
477
+ document.querySelectorAll(`.step-checkbox[data-step="${currentStep}"]:checked`).forEach(checkbox => {
478
+ playSound(checkbox.dataset.sound);
479
+ });
480
+
481
+ }, stepDuration * 1000);
482
+ }
483
+
484
+ function stopSequencer() {
485
+ clearInterval(sequencerInterval);
486
+ document.querySelectorAll('.step-checkbox').forEach(checkbox => {
487
+ checkbox.parentElement.style.backgroundColor = '';
488
+ });
489
+ currentStep = 0;
490
+ }
491
+
492
+ function randomizeSequencer() {
493
+ document.querySelectorAll('.step-checkbox').forEach(checkbox => {
494
+ checkbox.checked = Math.random() > 0.7;
495
+ });
496
+ }
497
+
498
+ // Initialize
499
+ window.addEventListener('load', () => {
500
+ loadSounds();
501
+ initVisualizer();
502
+
503
+ // Keyboard controls
504
+ document.addEventListener('keydown', (e) => {
505
+ const keyMap = {
506
+ '1': 'apple',
507
+ '2': 'banana',
508
+ '3': 'watermelon',
509
+ '4': 'grape',
510
+ '5': 'orange',
511
+ '6': 'strawberry',
512
+ '7': 'blueberry',
513
+ '8': 'lemon'
514
+ };
515
+
516
+ if (keyMap[e.key]) {
517
+ playSound(keyMap[e.key]);
518
+ }
519
+ });
520
+ });
521
+ </script>
522
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=Assad3l/ebala" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
523
+ </html>