Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- MusicManager.js +14 -14
- game.js +4 -1
- index.html +1 -1
MusicManager.js
CHANGED
|
@@ -30,11 +30,11 @@ export class MusicManager {
|
|
| 30 |
];
|
| 31 |
|
| 32 |
this.padPresets = [
|
| 33 |
-
{ name: '
|
| 34 |
-
{ name: '
|
| 35 |
-
{ name: '
|
| 36 |
-
{ name: 'Detuned Saw', oscillator: { type: 'fatsawtooth', spread: 40, count: 3 }, envelope: { attack: 0.
|
| 37 |
-
{ name: '
|
| 38 |
];
|
| 39 |
this.currentSynthIndex = 0;
|
| 40 |
|
|
@@ -44,7 +44,7 @@ export class MusicManager {
|
|
| 44 |
|
| 45 |
this._smoothDist = { thumb: 0, index: 0, middle: 0, ring: 0, pinky: 0 };
|
| 46 |
this._smoothDrumDist = { thumb: 0, index: 0, middle: 0, ring: 0, pinky: 0 };
|
| 47 |
-
this._SMOOTH_ALPHA = 0.
|
| 48 |
this._frameCount = 0; // throttle heavy updates to every 3rd frame
|
| 49 |
}
|
| 50 |
|
|
@@ -69,8 +69,8 @@ export class MusicManager {
|
|
| 69 |
|
| 70 |
// === MASTER EFFECTS CHAIN ===
|
| 71 |
this.limiter = new Tone.Limiter(-3).toDestination();
|
| 72 |
-
this.reverb = new Tone.Reverb({ decay:
|
| 73 |
-
this.delay = new Tone.PingPongDelay({ delayTime: '
|
| 74 |
this.chorus = new Tone.Chorus({ frequency: 2, delayTime: 4, depth: 0.7 }).connect(this.reverb);
|
| 75 |
this.chorus.start();
|
| 76 |
this.filter = new Tone.Filter(16000, 'lowpass').connect(this.chorus);
|
|
@@ -404,7 +404,7 @@ export class MusicManager {
|
|
| 404 |
}
|
| 405 |
}
|
| 406 |
if (this.middleContinuous && doHeavyUpdate) {
|
| 407 |
-
this.middleContinuous.volume.rampTo(-
|
| 408 |
}
|
| 409 |
|
| 410 |
// === RING (5th): Goa Pluck ===
|
|
@@ -427,7 +427,7 @@ export class MusicManager {
|
|
| 427 |
this._shimmerReverb.wet.value = 0.2 + d.ring * 0.6;
|
| 428 |
}
|
| 429 |
if (this.ringContinuous) {
|
| 430 |
-
this.ringContinuous.volume.rampTo(-
|
| 431 |
}
|
| 432 |
}
|
| 433 |
|
|
@@ -452,7 +452,7 @@ export class MusicManager {
|
|
| 452 |
this.distortion.wet.value = d.pinky * 0.5;
|
| 453 |
}
|
| 454 |
if (this.pinkyContinuous) {
|
| 455 |
-
this.pinkyContinuous.volume.rampTo(-
|
| 456 |
}
|
| 457 |
}
|
| 458 |
|
|
@@ -572,9 +572,9 @@ export class MusicManager {
|
|
| 572 |
// Middle=KICK, Ring=HIHAT, Pinky=CLAP
|
| 573 |
// =====================================================================
|
| 574 |
|
| 575 |
-
const DEAD_ZONE = 0.
|
| 576 |
-
const MIN_BPM =
|
| 577 |
-
const MAX_BPM =
|
| 578 |
|
| 579 |
const distToInterval = (dist) => {
|
| 580 |
if (dist < DEAD_ZONE) return Infinity;
|
|
|
|
| 30 |
];
|
| 31 |
|
| 32 |
this.padPresets = [
|
| 33 |
+
{ name: 'Ambient Sub', oscillator: { type: 'sine' }, envelope: { attack: 0.8, decay: 0.6, sustain: 0.7, release: 1.0 } },
|
| 34 |
+
{ name: 'Dub Growl', oscillator: { type: 'sawtooth' }, envelope: { attack: 0.3, decay: 0.5, sustain: 0.5, release: 0.8 } },
|
| 35 |
+
{ name: 'Dream Wash', oscillator: { type: 'triangle' }, envelope: { attack: 1.0, decay: 0.8, sustain: 0.6, release: 1.2 } },
|
| 36 |
+
{ name: 'Detuned Saw', oscillator: { type: 'fatsawtooth', spread: 40, count: 3 }, envelope: { attack: 0.6, decay: 0.5, sustain: 0.7, release: 1.0 } },
|
| 37 |
+
{ name: 'Warm Square', oscillator: { type: 'fatsquare', spread: 20, count: 3 }, envelope: { attack: 0.5, decay: 0.4, sustain: 0.6, release: 0.8 } }
|
| 38 |
];
|
| 39 |
this.currentSynthIndex = 0;
|
| 40 |
|
|
|
|
| 44 |
|
| 45 |
this._smoothDist = { thumb: 0, index: 0, middle: 0, ring: 0, pinky: 0 };
|
| 46 |
this._smoothDrumDist = { thumb: 0, index: 0, middle: 0, ring: 0, pinky: 0 };
|
| 47 |
+
this._SMOOTH_ALPHA = 0.3; // balanced: responsive but not jittery
|
| 48 |
this._frameCount = 0; // throttle heavy updates to every 3rd frame
|
| 49 |
}
|
| 50 |
|
|
|
|
| 69 |
|
| 70 |
// === MASTER EFFECTS CHAIN ===
|
| 71 |
this.limiter = new Tone.Limiter(-3).toDestination();
|
| 72 |
+
this.reverb = new Tone.Reverb({ decay: 8, preDelay: 0.05, wet: 0.45 }).connect(this.limiter);
|
| 73 |
+
this.delay = new Tone.PingPongDelay({ delayTime: '4n', feedback: 0.4, wet: 0.25 }).connect(this.reverb);
|
| 74 |
this.chorus = new Tone.Chorus({ frequency: 2, delayTime: 4, depth: 0.7 }).connect(this.reverb);
|
| 75 |
this.chorus.start();
|
| 76 |
this.filter = new Tone.Filter(16000, 'lowpass').connect(this.chorus);
|
|
|
|
| 404 |
}
|
| 405 |
}
|
| 406 |
if (this.middleContinuous && doHeavyUpdate) {
|
| 407 |
+
this.middleContinuous.volume.rampTo(d.middle < 0.1 ? -Infinity : -36 + d.middle * 22, 0.1);
|
| 408 |
}
|
| 409 |
|
| 410 |
// === RING (5th): Goa Pluck ===
|
|
|
|
| 427 |
this._shimmerReverb.wet.value = 0.2 + d.ring * 0.6;
|
| 428 |
}
|
| 429 |
if (this.ringContinuous) {
|
| 430 |
+
this.ringContinuous.volume.rampTo(d.ring < 0.1 ? -Infinity : -40 + d.ring * 22, 0.1);
|
| 431 |
}
|
| 432 |
}
|
| 433 |
|
|
|
|
| 452 |
this.distortion.wet.value = d.pinky * 0.5;
|
| 453 |
}
|
| 454 |
if (this.pinkyContinuous) {
|
| 455 |
+
this.pinkyContinuous.volume.rampTo(d.pinky < 0.1 ? -Infinity : -40 + d.pinky * 22, 0.1);
|
| 456 |
}
|
| 457 |
}
|
| 458 |
|
|
|
|
| 572 |
// Middle=KICK, Ring=HIHAT, Pinky=CLAP
|
| 573 |
// =====================================================================
|
| 574 |
|
| 575 |
+
const DEAD_ZONE = 0.18; // larger dead zone = cleaner silence
|
| 576 |
+
const MIN_BPM = 30; // slower, more ambient
|
| 577 |
+
const MAX_BPM = 160; // downtempo cap
|
| 578 |
|
| 579 |
const distToInterval = (dist) => {
|
| 580 |
if (dist < DEAD_ZONE) return Infinity;
|
game.js
CHANGED
|
@@ -451,6 +451,8 @@ export var Game = /*#__PURE__*/ function() {
|
|
| 451 |
this.renderer.domElement.style.left = '0';
|
| 452 |
this.renderer.domElement.style.zIndex = '1'; // Canvas on top of video
|
| 453 |
this.renderer.domElement.style.mixBlendMode = 'screen';
|
|
|
|
|
|
|
| 454 |
this.renderDiv.appendChild(this.renderer.domElement);
|
| 455 |
this.displacementFilter = new DisplacementFilter(this.renderer.domElement, this.videoElement);
|
| 456 |
var gameRef = this;
|
|
@@ -1064,7 +1066,8 @@ export var Game = /*#__PURE__*/ function() {
|
|
| 1064 |
'C4', 'Eb4', 'F4', 'G4', 'Bb4',
|
| 1065 |
'C5', 'Eb5', 'F5'
|
| 1066 |
];
|
| 1067 |
-
|
|
|
|
| 1068 |
} catch (error) {
|
| 1069 |
console.error("Error during hand detection:", error);
|
| 1070 |
}
|
|
|
|
| 451 |
this.renderer.domElement.style.left = '0';
|
| 452 |
this.renderer.domElement.style.zIndex = '1'; // Canvas on top of video
|
| 453 |
this.renderer.domElement.style.mixBlendMode = 'screen';
|
| 454 |
+
// Glow/trail effect via CSS β lightweight, GPU-composited
|
| 455 |
+
this.renderer.domElement.style.filter = 'blur(0.8px) brightness(1.2) drop-shadow(0 0 8px rgba(255,0,255,0.4)) drop-shadow(0 0 20px rgba(0,255,255,0.2))';
|
| 456 |
this.renderDiv.appendChild(this.renderer.domElement);
|
| 457 |
this.displacementFilter = new DisplacementFilter(this.renderer.domElement, this.videoElement);
|
| 458 |
var gameRef = this;
|
|
|
|
| 1066 |
'C4', 'Eb4', 'F4', 'G4', 'Bb4',
|
| 1067 |
'C5', 'Eb5', 'F5'
|
| 1068 |
];
|
| 1069 |
+
var handLimit = this._multiplayerEnabled ? this.hands.length : 2;
|
| 1070 |
+
for(var i = 0; i < handLimit; i++)_this1 = this, _loop(i);
|
| 1071 |
} catch (error) {
|
| 1072 |
console.error("Error during hand detection:", error);
|
| 1073 |
}
|
index.html
CHANGED
|
@@ -51,7 +51,7 @@
|
|
| 51 |
<span class="hint-icon">ποΈ</span><span class="hint-desc">Extend fingers = play chord notes</span>
|
| 52 |
<span class="hint-icon">β</span><span class="hint-desc">Make fist = cycle synth sound</span>
|
| 53 |
<span class="hint-icon">π€²</span><span class="hint-desc">Tilt wrist = filter sweep + detune</span>
|
| 54 |
-
<span class="hint-icon">π€</span><span class="hint-desc">2nd hand
|
| 55 |
<span class="hint-icon">π</span><span class="hint-desc">Spread fingers wide = wobble bass</span>
|
| 56 |
<span class="hint-icon">π</span><span class="hint-desc">Touch fingertips together = sparkle sounds</span>
|
| 57 |
</div>
|
|
|
|
| 51 |
<span class="hint-icon">ποΈ</span><span class="hint-desc">Extend fingers = play chord notes</span>
|
| 52 |
<span class="hint-icon">β</span><span class="hint-desc">Make fist = cycle synth sound</span>
|
| 53 |
<span class="hint-icon">π€²</span><span class="hint-desc">Tilt wrist = filter sweep + detune</span>
|
| 54 |
+
<span class="hint-icon">π€</span><span class="hint-desc">2nd hand = kick Β· hihat Β· clap (distance = tempo)</span>
|
| 55 |
<span class="hint-icon">π</span><span class="hint-desc">Spread fingers wide = wobble bass</span>
|
| 56 |
<span class="hint-icon">π</span><span class="hint-desc">Touch fingertips together = sparkle sounds</span>
|
| 57 |
</div>
|