Fix bass channel - warmer, less synthetic sound

- Use pure triangle wave for bass preset (warmest option)
- Reduce harmonics from 64 to 16 with gentle rolloff
- Add 2kHz low-pass filter to wave channel
- Route all wave sounds through filter for warmth
This commit is contained in:
b1rdmania
2026-01-20 19:50:55 +00:00
parent 42b65b2a30
commit 9311e82538
2 changed files with 29 additions and 22 deletions
+12 -3
View File
@@ -34,6 +34,7 @@ export class WaveChannel {
private volume: WaveVolume = 1; // Default to 100%
private outputNode: GainNode;
private currentPreset: WavePreset;
private lowpassFilter: BiquadFilterNode;
constructor(
audioContext: AudioContext,
@@ -44,6 +45,14 @@ export class WaveChannel {
this.outputNode = outputNode;
this.currentPreset = preset;
// Create a low-pass filter to warm up the sound
// GB wave channel had natural rolloff from the DAC
this.lowpassFilter = audioContext.createBiquadFilter();
this.lowpassFilter.type = 'lowpass';
this.lowpassFilter.frequency.value = 2000; // Cut harsh highs
this.lowpassFilter.Q.value = 0.7;
this.lowpassFilter.connect(outputNode);
// Initialize wavetable with preset
this.waveTable = new WaveTable();
this.loadPreset(preset);
@@ -149,9 +158,9 @@ export class WaveChannel {
const stopTime = now + duration + releaseTime;
gain.gain.linearRampToValueAtTime(0.001, stopTime);
// Connect nodes
// Connect nodes through low-pass filter for warmer sound
oscillator.connect(gain);
gain.connect(this.outputNode);
gain.connect(this.lowpassFilter);
// Schedule playback
oscillator.start(now);
@@ -211,7 +220,7 @@ export class WaveChannel {
gain.gain.linearRampToValueAtTime(0.001, stopTime);
oscillator.connect(gain);
gain.connect(this.outputNode);
gain.connect(this.lowpassFilter);
oscillator.start(now);
oscillator.stop(stopTime + 0.01);