Add waveform (oscilloscope) and band-reactive effect families
- Time-domain waveform uniform (uWave) fed to the shader. - New families: Waveform, Waveform Radiale, Tri-Banda (concentric per-band zones), and Reattivo Bassi/Medi/Alti (single-band reactive). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
19085e9c16
commit
5f9e33b7dd
4 files changed
+79
-3
No files matched your search
+13
-1
@@ -48,6 +48,11 @@ class AudioEngine {
|
||||
// Log-spaced spectrum for VU/bar visualisers.
|
||||
this.NB = 32;
|
||||
this.spectrum = new Float32Array(this.NB);
|
||||
|
||||
// Time-domain waveform (oscilloscope), -1..1.
|
||||
this.NW = 128;
|
||||
this.wave = new Float32Array(this.NW);
|
||||
this.timeData = new Uint8Array(this.analyser.fftSize);
|
||||
}
|
||||
|
||||
resume() { if (this.ctx.state === 'suspended') this.ctx.resume(); }
|
||||
@@ -213,6 +218,13 @@ class AudioEngine {
|
||||
this.spectrum[i] = this.spectrum[i] * 0.55 + val * 0.45; // smooth
|
||||
}
|
||||
|
||||
// Time-domain waveform.
|
||||
this.analyser.getByteTimeDomainData(this.timeData);
|
||||
const wstep = this.timeData.length / this.NW;
|
||||
for (let i = 0; i < this.NW; i++) {
|
||||
this.wave[i] = (this.timeData[Math.floor(i * wstep)] - 128) / 128;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -222,7 +234,7 @@ class AudioEngine {
|
||||
}
|
||||
|
||||
get values() {
|
||||
return { bass: this.bass, mid: this.mid, treble: this.treble, level: this.level, beat: this.beat, spectrum: this.spectrum };
|
||||
return { bass: this.bass, mid: this.mid, treble: this.treble, level: this.level, beat: this.beat, spectrum: this.spectrum, wave: this.wave };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user