How do you access Scriptnode Synth voices?
-
What's the proper way to access voices of a scriptnode synthesizer in script?
I'm looking for a way to e.g. detune a particular voice as if a voice board was damaged or send LFO and bend information to a particular voice... I recon there must be some sort of list or array that let's me get the playing voices. I'm using custom faust oscillators in a hardcoded fx, so basically looking for a way to access a certain voices parameters, not all at once -
@Morphoice You can store the node ID in a global and access it using the Message class in the code portion of a script voice start modulator (the code editor, not the scriptnode network).
You can use event data and access that, which also lets you access that data inside of Scriptnode.
In any case, you want a return of 0-1, where for bipolar mods 0.5 is the neutral position.
-
@aaronventure nothing I've ever done before, but I'll fight my way through it. If you know of any examples that showcase this please let me know. I can't find anything in the docs
-
This post is deleted! -
- store your note id into a global. declare this global in on init, if you're using multiple notes, you can make the global an array
global noteIds = [];
and then store note ids into indexes by note number
nodeIds[noteNum] = playNote; // or just pull in the event node if you're not handling note playback yourself
- You have two ways of modulating individual events using their IDs
× Voice start script modulator - is applied at the start of the note. You can write the code and just have to return a value 0-1
function onVoiceStart(voiceIndex) { // perhaps you have per note pitch changes done via the UI, and you're storing this into another global array // you can set a condition so that only the notes that you stored into the noteIds array get this modulation applied. This way if you have other notes firing (for complex samplemaps etc.) you can selectively apply the voice start modulation via code if (Message.getEventId() == noteIds[Message.getNoteNumber()]) return notePitchMod[Message.getNoteNumber()];
× Envelope script modulator
In both cases, you can also use ScriptNode, making sure that the network output is also 0-1 (with 0.5 being the neutral/midpoint). In that case, when playing notes and/or storing IDs, you would be using the event data method, and then using the event data nodes to get that data individually for each event. In this case, you can modulate it in realtime. Check the snippets (or the snippet waiting room if it hasn't been merged yet) where I posted an example for this.
-
@aaronventure awesome thank you!
I'm trying to decide whether it makes sense to put my LFO's inside the faust oscillator, as faust offers the most flexible LFO shapes for my need, and I can get up to FM modulation levels with the LFO speed, or if it makes more sense having a global LFO generator in an extra ScriptFX and distributing it's modulation in the way you described... I wouldn't need individual LFO's on all notes so that probably makes more sense, but there is the issue of aftertouch and velocity sensitivity that requires the lfo to be applied accordingly to each note -
@Morphoice if you don't need polyphonic modulation, just use the Time Variant modulator. That one is monophonic.
-
@aaronventure just the amount applied needs to be "polyphonic", not the type of modulation itself
but I could do that with an "intensity" pma node inside the oscillator network where I already have the velocity informationI also have a hardcoded LFO in the faust oscillator but it's not time synced among all notes of course. that might be a benefit considering playability and sound design capability
I guess the CPU overhead of running seperate LFO oscillators on each voice is superficial