Skip to content

Commit

Permalink
Wiki update and chorus improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Sep 23, 2023
1 parent 6997677 commit f866d3f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/spessasynth_lib/sequencer/sequencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 7 additions & 3 deletions src/spessasynth_lib/synthetizer/buffer_voice/chorus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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| -------+
+----------+ +----------+
*/

Expand All @@ -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);
}

/**
Expand All @@ -67,5 +70,6 @@ export class Chorus
{
this.input.disconnect(this.wetController);
this.delayLine.disconnect(this.output);
this.input.disconnect(this.output);
}
}
10 changes: 3 additions & 7 deletions src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -314,7 +311,6 @@ export class MidiChannel {
setChorus(chorus)
{
this.chorus.setChorusLevel(chorus);
this.updateGain();
}

setVolume(volume) {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit f866d3f

Please sign in to comment.