I am including a gig file to demonstrate the scenario,
The rackspace has 3 variations: “4 synths”, “3 synths”, and “2 synths”.
If you look at the Panels mode on the “4 synths” variation, you will see that all 4 synths are active and the DIVISI scriptlet works fine.
However, on the “3 synths” variation, the 3rd synth is purposely bypassed. So if you play a 4-note chord, the DIVISI scriptlet will send a note-on msg to the third synth but it will not make a sound because it is bypassed.
A similar situation occurs on the “2 synths” variation: the first and third note of the chord does not play for the same reason.
I would like to have the scriptlet check the four widgets and then map the DIVISI channel assignment accordingly. EG: if the third synth is bypassed as in the “3 synths” variation then the DIVISI scriplet should not try to distribute a note-on msg to channel 3 … but instead distribute to channels 1, 2, and 4.
I am a novice in writing scriplets as I have not mastered the language as of yet and this would require elegant code. So, any help would be appreciated.
DIVISI question to ask the Community.gig (83.7 KB)
Just an idea, does not work perfect, but you get the idea.
Add 4 Parameters to the scriptlet code and map the widget to this scriptlet parameters
//SetInfoMessage("Each new played note a new midi channel. Play a monophonic (example SWAM) with chords when you route each channel to a different instance.")
var nt : NoteTracker
na : int
P1 : Parameter := 1.0
P2 : Parameter := 1.0
P3 : Parameter := 1.0
P4 : Parameter := 1.0
ch : Integer
on NoteOnEvent (m : NoteMessage)
na[GetNoteNumber(m)] = NoteTracker_NoteOnCount(nt)
ch = na[GetNoteNumber(m)]
if ch == 1 and P1 == 0.0 then
ch = 2
if ch == 2 and P2 == 0.0 then
ch = 3
if ch == 3 and P2 == 0.0 then
ch = 4
if ch == 4 and P2 == 0.0 then
ch = 5
// Print( na[GetNoteNumber(m)])
on NoteOffEvent (m : NoteMessage)
The trick is to get the correct channel depending on the parameter values.
I can’t wait to try the scriptlet this evening!
The code looks like it will work as it is testing each widget’s value (“on” or “off”) consecutively. If “off” it is moving to the next channel and so on and so forth. It is so simple, it is brilliant!
I am not exactly sure how I map the widgets. Do I simply give the widgets corresponding handles of P1, P2, P3, and P4 … and I’m done?
Just assign the widgets to the scriptlet parameters