diff --git a/README.md b/README.md index 6f426e18..4a62d22a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ SoundFont2 based realtime synthetizer and MIDI player written in JavaScript usin - Comes bundled with a small [GeneralUser GS](https://schristiancollins.com/generaluser.php) soundFont to get you started ### Limitations -- The program currently supports no modulators (Work in progress) and no reverb nor chorus. +- The program currently supports no modulators (Work in progress) and no reverb. - It might not sound as good as other synthetizers (e.g. FluidSynth or BASSMIDI) ## Installation @@ -56,6 +56,7 @@ The program is divided into parts: ## Currently supported generators - Full volume envelope - All address offsets +- Chorus (on channel level) - Looping modes - FilterFc and FilterQ - Modulation envelope for the low-pass filter (attack is linear instead of convex) diff --git a/src/spessasynth_lib/sequencer/sequencer.js b/src/spessasynth_lib/sequencer/sequencer.js index ab2daf70..36042494 100644 --- a/src/spessasynth_lib/sequencer/sequencer.js +++ b/src/spessasynth_lib/sequencer/sequencer.js @@ -643,6 +643,7 @@ export class Sequencer { { clearInterval(this.playbackInterval); this.playbackInterval = undefined; + // disable sustain for (let i = 0; i < 16; i++) { this.synth.controllerChange(i, midiControllers.sustainPedal, 0); } diff --git a/src/spessasynth_lib/synthetizer/buffer_voice/chorus.js b/src/spessasynth_lib/synthetizer/buffer_voice/chorus.js index 1969612f..0fbfaf6e 100644 --- a/src/spessasynth_lib/synthetizer/buffer_voice/chorus.js +++ b/src/spessasynth_lib/synthetizer/buffer_voice/chorus.js @@ -29,13 +29,14 @@ export class Chorus }); this.delayOscillator.start(); - /* + /* +----------------------------------------------+ + | \|/ +-----+ +--------------+ +----------+ +------+ - |input| -> |wet controller| -> |delay line| -> |output| + |input|--->|wet controller|--->|delay line|--->|output| +-----+ +--------------+ +----------+ +------+ /|\ delay time +----------+ +----------+ | - |oscillator| -> |delay gain| -------+ + |oscillator|--->|delay gain| -------+ +----------+ +----------+ */ @@ -45,6 +46,8 @@ export class Chorus this.input.connect(this.wetController); this.wetController.connect(this.delayLine); this.delayLine.connect(this.output); + + this.input.connect(this.output); } /** @@ -67,5 +70,6 @@ export class Chorus { this.input.disconnect(this.wetController); this.delayLine.disconnect(this.output); + this.input.disconnect(this.output); } } \ No newline at end of file diff --git a/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js b/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js index f0f0189b..f95d168a 100644 --- a/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js +++ b/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js @@ -56,13 +56,10 @@ export class MidiChannel { gain: CHANNEL_LOUDNESS }); - // note -> panner -> gain -> out - // \-> chorus -/ - this.panner.connect(this.gainController); - this.gainController.connect(this.outputNode); + // note -> panner -> chorus -> gain -> out - // chorus this.chorus = new Chorus(this.panner, this.gainController, 0); + this.gainController.connect(this.outputNode); this.resetControllers(); @@ -314,7 +311,6 @@ export class MidiChannel { setChorus(chorus) { this.chorus.setChorusLevel(chorus); - this.updateGain(); } setVolume(volume) { @@ -470,7 +466,7 @@ export class MidiChannel { this.gainController.gain.value = this.defaultGain * this.channelVolume * this.channelExpression - * (1 - this.chorus.getChorusLevel() / 381); // lower the volume to min 2/3 to compensate for delay line (it doubles the volume) + //* (1 - this.chorus.getChorusLevel() / 381); // lower the volume to min 2/3 to compensate for delay line (it doubles the volume) } muteChannel()