diff --git a/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js b/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js index 9094c9e6..9d869a81 100644 --- a/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js +++ b/src/spessasynth_lib/synthetizer/buffer_voice/midi_channel.js @@ -2,11 +2,9 @@ import {Voice} from "./voice.js"; import {Preset} from "../../soundfont/chunk/presets.js"; import { consoleColors } from '../../utils/other.js' import { midiControllers } from '../../midi_parser/midi_message.js' -import { DEFAULT_GAIN } from '../synthetizer.js' const CHANNEL_LOUDNESS = 0.5; - const dataEntryStates = { Idle: 0, RPCoarse: 1, @@ -57,12 +55,12 @@ export class MidiChannel { gain: CHANNEL_LOUDNESS }); - // note -> panner -> gain -> out // \-> chorus -> delay -/ this.panner.connect(this.gainController); this.gainController.connect(this.outputNode); + this.chorusController = new GainNode(this.ctx, { gain: 0 }); @@ -233,7 +231,7 @@ export class MidiChannel { setExpression(val) { - val = Math.min(1, val); + //val = Math.min(1, val); this.channelExpression = val; this.updateGain(); } @@ -370,8 +368,8 @@ export class MidiChannel { { if(this.vibrato.delay === 0 && this.vibrato.rate === 0 && this.vibrato.depth === 0) { - this.vibrato.depth = 30; - this.vibrato.rate = 6; + this.vibrato.depth = 50; + this.vibrato.rate = 8; this.vibrato.delay = 0.6; } } diff --git a/src/spessasynth_lib/synthetizer/buffer_voice/synthesis_model.js b/src/spessasynth_lib/synthetizer/buffer_voice/synthesis_model.js index 06fe0a32..bd616a61 100644 --- a/src/spessasynth_lib/synthetizer/buffer_voice/synthesis_model.js +++ b/src/spessasynth_lib/synthetizer/buffer_voice/synthesis_model.js @@ -4,13 +4,15 @@ export class SynthesisModel { /** * Creates a new instance of a single sample - * @param synthesisOptions {GeneratorTranslator} + * @param sampleAndGenerators {SampleAndGenerators} + * @param midiNote {number} * @param outputNode {AudioNode} * @param tuningRatio {number} * @param velocity {number} * @param vibratoDepth {number} in cents */ - constructor(synthesisOptions, outputNode, tuningRatio, velocity, vibratoDepth) { + constructor(sampleAndGenerators, midiNote, outputNode, tuningRatio, velocity, vibratoDepth) { + const synthesisOptions = new GeneratorTranslator(sampleAndGenerators, midiNote, velocity); const context = outputNode.context; const sample = synthesisOptions.sample; const offsets = synthesisOptions.getAddressOffsets(); @@ -232,7 +234,7 @@ export class SynthesisModel // filter too if(this.lowpassFilter) { this.lowpassFilter.frequency.setValueAtTime(this.lowpassFilter.frequency.value, this.now); - this.lowpassFilter.frequency.linearRampToValueAtTime(this.filEnv.endHz, this.now + this.filEnv.releaseTime); + this.lowpassFilter.frequency.exponentialRampToValueAtTime(this.filEnv.endHz, this.now + this.filEnv.releaseTime); } if(!this.wavetableOscillator.loop) diff --git a/src/spessasynth_lib/synthetizer/buffer_voice/voice.js b/src/spessasynth_lib/synthetizer/buffer_voice/voice.js index 8c8af16b..c7afdb48 100644 --- a/src/spessasynth_lib/synthetizer/buffer_voice/voice.js +++ b/src/spessasynth_lib/synthetizer/buffer_voice/voice.js @@ -1,5 +1,4 @@ import {Preset} from "../../soundfont/chunk/presets.js"; -import {GeneratorTranslator} from "./generator_translator.js"; import { SynthesisModel } from './synthesis_model.js' export class Voice @@ -48,7 +47,8 @@ export class Voice */ this.sampleNodes = samples.map(samAndGen => { const sm = new SynthesisModel( - new GeneratorTranslator(samAndGen, midiNote, targetVelocity), + samAndGen, + midiNote, node, this.tuningRatio, this.velocity, diff --git a/src/spessasynth_lib/synthetizer/synthetizer.js b/src/spessasynth_lib/synthetizer/synthetizer.js index bc2036f1..3ea451c5 100644 --- a/src/spessasynth_lib/synthetizer/synthetizer.js +++ b/src/spessasynth_lib/synthetizer/synthetizer.js @@ -46,19 +46,12 @@ export class Synthetizer { */ this.system = "gm2"; - /** - * @type {WorkletChannel[]} - */ - this.midiChannels = []; this.defaultPreset = this.soundFont.getPreset(0, 0); this.percussionPreset = this.soundFont.getPreset(128, 0); // create 16 channels - for (let j = 0; j < 16; j++) { - // default to the first preset - this.midiChannels[j] = new MidiChannel(this.volumeController, this.defaultPreset, j + 1, false); - } + this.midiChannels = [...Array(16).keys()].map(j => new MidiChannel(this.volumeController, this.defaultPreset, j + 1, false)); // change percussion channel to the percussion preset this.midiChannels[DEFAULT_PERCUSSION].percussionChannel = true; diff --git a/src/website/ui/synthesizer_ui/synthetizer_ui.js b/src/website/ui/synthesizer_ui/synthetizer_ui.js index 46f85928..7eed7f6c 100644 --- a/src/website/ui/synthesizer_ui/synthetizer_ui.js +++ b/src/website/ui/synthesizer_ui/synthetizer_ui.js @@ -254,7 +254,7 @@ export class SynthetizerUI const expression = new Meter(this.channelColors[channelNumber], "Expression: ", 0, - 127, + 256, true, val => { this.synth.controllerChange(channelNumber, midiControllers.expressionController, val);