Enable Specific Sampler for Synth.playNote()
-
I'm working on a project with many samples. This has led me to place multiple samples on the same keys, but in different samplers. I'm ignoring the original event and creating a new one using
Synth.playNote(). How can I make it so that only a specified sampler is triggered by this event?In addition to this, can I adjust the gain of this note using the returned event ID of
Synth.playNote()? -
@obolig Put the script that plays the note within the sampler's MIDI processor chain, then it will only affect that sampler.
You can use Synth.addVolumeFade to control the gain.
-
Thank you for the help @David-Healey ! This worked perfectly.
I would like to include a few additional notes. There is a good bit of information that needed to be passed to each sampler. The interface relayed this information to controls in the MIDI Processors via interface control callbacks in the following format:
scriptProcessor.setAttribute(controlIdx, value);In the
onNoteOnblock,Message.ignoreEvent(true)andMessage.makeArtificial()were called. The note IDs produced by theSynth.playNote()command were stored in an array that was referenced when turning off the notes withSynth.noteOffByEventId()in theonNoteOffblock. -
O obolig has marked this topic as solved