Hey there I am trying to to get every first, every second, and every third note in my polyphonic subpatch.
I tried it with the modulo operator and with the following but it only works sometimes. does anyone know why?
thanks in advance,
Flub
Polyindex -> mux not working right
Hey thanks for your reply . But it did not solve the problem . I only need seperate integers . I think sometimes the polyindex counting has jumps in it . But I am not sure if that’s the problem. I just want that if I press 3 keys one of them is voice 1 one is voice 2 and the other is voice 3 the fourth key should be voice 1 again...
But I don’t want to miss the polyphony of 8 or so i just want to seperate The 8 into 3 variations and I wondered why the patch above did not work always but sometimes
ok. how do the midi notes arrive?
do you play one after each other, or do you also play chords?
what sorting do you expect in case of chords? from low to high, high to low?
i am not sure the poly index simply counts through and starts over again. i imagine it is more some sort of notes pool, and the places that are empty can be filled. (so that voice stealing etc. works) but i am not sure about that.
so that might mean, you or somebody else has to write a dedicated object for that.
I connected a usb midi keyboard the usb input of the axoloti board.
I want to play chords or single notes. I was okay with the order not being fixed from low to high or from high to low.
but anyways what I dont understand is that the polyindex must in any case a number between 0 and number of voices-1
where every voice number exists only 1 time. In my case I play a Chord and sometimes two voices/keypresses get the same polyindex. I might be a timing issue that the mux gets set to late and still has the inputselect integer from a note before. But I dont know how to affect this...
as @lokki already said...if you using 8 voices, then you are going to have duplicates
as essentially your doing 8 % 3.
so there are N (8 in this case) voices (set in your poly for the subpatch) , and voices are allocated based on the time that voice was used (i.e. oldest is used next), so once you've started playing a few notes, especially chords, the actual voice used will get tricky for you to track, as depends on exactly which order you released keys.
(so it is completely predictable, but easy to lose track of when your playing)
btw: what id recommend you do when your trying to debug these kind of things, is try to print something to the console log, e.g. my print object will help... this way you'll be able to see what polyindex is returning.
I think this would show you, you are not getting two voices with the same index
Ah thank you, this might be the key ! that the polyindex depends on the key release not on the key down.
I already looked if I can find a print object and I didnt find one. I take a further look and try to solve my problem with that.
Thanks. ill come back if I find a solution. If somebody understood my problem and knows the solution already. feel free to share it = )
EDIT: polyindex to tb/disp/print i does not work. it shows alle indexes once on startup in the console and then does not do anything further when i press keys.
Isnt there a way to access data stored in parent patch from subppatch then I could simply use a counter on the parent patch to cycle between 0 1 2 0 1 2 every time a key is pressed?
Or how can I get the number of keys Pressed inside a polyphonic subpatch?
SOLUTION:
I created a custom object from the paraphonic objekt
int channel = (status & 0xf) + 1;
int cmd = (status & 0x70) >> 4;
if ((channel!=attr_MIDIchannel && attr_MIDIchannel>0)) {
return;
}
// some midi devices send note on with velocity 0 instead of note off
if (cmd==1 && data2==0) {
cmd = 0;
}
if (cmd==1 ) {
// check if there is a free channel
for (chIndex=0; chIndex<MAX_CHANNELS;chIndex++) {
if(channels[chIndex] == 0) {
channels[chIndex] = data1;
break;
}
}
chIndex++;
if (chIndex >= MAX_CHANNELS) {
chIndex = 0;
}
}
else if (cmd==0) {
// note off
for (chIndex=0; chIndex<MAX_CHANNELS;chIndex++) {
if(channels[chIndex] == data1) {
channels[chIndex] = 0;
break;
}
}
}
if ((cmd == 3)&&(data1 == 123)) { // all notes off message
for (int i=0;i<MAX_CHANNELS;i++) {
channels[chIndex] = 0;
}
chIndex = 0;
}
master4.axp (76.4 KB)
I recommend you start to check how things work rather than just declaring them as 'not working', this way you'll be able to use things to help build your understanding, or adapt to your use-case.
print, will only print when a values change - this means you would need to do something like set it back to zero on note-off
(why does print work like this? well remember axoloti is continuously processing objects, so if it didn't it would constantly print sending output to the console)
yes, the easiest way is to use a table object, even if its only got one entry.
(see table help for example on how to access parent tables)
Thank you for helping me. how can I find out how the object works ? Is there anything else than looking into the edit object dialogs?
Regards , Flub