poly note vs midinote
Because I wish to take use of midi/off velocity (and some other stuff) I'd like to send a custom message to an instance of poly (5part list i.e.) but i'd also like that poly knows when i'm sending an "off" message to that poly which receives the off.
Is this possible any other way than doing it with counter and specific instances? Because midi note handles that automatically but it doesn't work with off/velocity (+ other parameters i'd like to send separated to each enabled voice).
The only way i can think of is using a massive routing system or a counter that counts the number of instances of poly and assignes specific notes automatically... which is tedious and complicated.
Is there anyway to tell poly "send this to the same voice that the other thing before was sent." like midi note?
I have another idea (but am too sleepy to test it), if i set the poly patcher to have an internal memory so it remembers the input it first receives, and when it receives a "note off" its filtered by other active voices because they have different memory. That can't trigger a new instance because it (note/off) would be sent directly to output not via "note" message, would trigger the mute 1 and cleared the memory of the patcher... So then, the next voice that comes via message "note" can occupy its spot? I think thats the most elegant solution so far with least data redundancy. It's easy to set so note/off goes without "note" prepended and note/on goes in with prepended "note" message. I think i'll do that if there isn't a simpler solution. (like being references by the first number of the list i.e. like a note number.)
your explanation sounds a bit confusing to me... i guess you're trying to send note on, then note off WITH velocity (to the same instance), is it right?
if that's so, and if it's only these two mesages you want to send for each note (the 5-part lists), then you might just try to use midinote indeed, sort of: "midinote noteNumber 0 offVel whateverElse", so that 0 cheats [poly~] to send it to same instance, then you use next number as note off velocity.
if you want to send more than note on/off messages, that's another thing. but again, i can't really figure out what you're really doing, where you're getting the note messages from, and what you wanna do with the lists to [poly~]... :)
I actually need to send a 3-part message i figured, everything else is either constant or send to every instance. "freq, velocity, on/off" i.e. 548 25 1 or 548 25 0.
As far as I recall poly~ kills the voice with a note/off message? I need it to close the adsr rather then kill it.
I need to control adsr release and attack with velocity on and velocity off (and of course i need to send a mute command to adsr which is connected to this poly to mute it) and a frequency of the instance.
Also, i need like, at least 140 different "notes", so midi note is out of range.
i think what "midinote" does is just select an idle instance for note on (just as "note" does) AND send note off to same instance as corresponding note on, understanding first and second values in the list as note-velocity (0 meaning note off).
but it doesn't kill the voice, you have to do it with "mute 1" to [thispoly~]. so if you send "midinote noteNumber 1/0 velocity", you'll have messsages send to right instances(1 will be interpreted as on, 0 as off), then you can use the third value in the list as velocity, both with note on and note off. and only mute and set state to non-busy when the release part of the adsr is done.
but i don't know now if i'm making sense any more... maybe a patch will help.
the 140 different notes issue seems tricky. in another situation you could use some msb-lsb thing: use yet another value in the list so that you have more than 7bits. but of course that would mess things up, dealing with [poly~].
hm yes, i can see where you are going, but its time for some dummy patcher to try each method and see what works and what not.
Thanks, you gave me a few ideas to try out. Ain't going the msb/lsb route though.. no way. :D
Lol! It's so simple i can't believe i didn't try it!
Midi note works well over its native range. i.e., "midinote 256 x y z e" works flawlessly.
let me sum up just in case a lost soul wander here after 3 years :P
"note" allows you to send a message to an open voice. In order to close it, you need to know which instance was called upon, or have it close automatically (via timer) or via send/recieve by another function.
HOWEVER, midinote sends a message to an open voice, and allows you to send another message to close it if the message begins with "midinote $i 0"
This is pretty much what you told me, the only difference is that i wasn't aware that midinote works well over midrange. Theoretically, you can use any number as midinote. Brilliant. My problem is solved, this is exactly what I need, because I can simply ignore the midi off (0) message and close it via ADSR when midi/off is received.
You can also send it a list which can be as long as you wish, as long as the syntax is "midinote "note number" "velocity/0" value value value value value..."
My god I have to rewrite this post, its awful.
wahaha... one never considers the easy path on a first try. in fact that makes sense (there's no real MIDI in there, so no 7bits limit), though i didn't consider it neither. why should't it? plain and simple...
wouldn't it have been crazy to get a headache with lsb paraphernalia? XD
Haha :D indeed. I was getting pretty desperate. I was waiting for someone and had my laptop with me and it just hit me "hey perhaps it actually works?!" and it does. Awesome moment
let me sum up just in case a lost soul wander here after 3 years :P
Thanks Ploki!
using 140 notes is the least problem in max. you can use 100,000 if you want.
but you should eventually consider to use floating point note numbers such as 60.33, or even convert to Hz already outside the poly.
this is just my personal opinion, but you know that you do not _have to use this "midinote" and auto-voicing rubbish, do you?
the more complex a poly system ist, the more i would recommend to control the voicing with a custom method - one which fits to the purpose of the poly patcher.
my synths for example usually activate voices in order (1,2,3,4,5,6,7,8,1,2,3....), and, more important, i control that from outside the poly, so that i always have control over which voice will be activated next. if it is not about chords but about round robin, you can replace that easily with random numbers...
furthermore, which such a implementation it is now also easily possible to control the numbers of voices while the thing runs.
or build mute groups for percussion- or string-like instruments.
or let every incoming velocity control the gain of the _last or _next note instead of _this one...
-110
Sounds like the midinote lookup system is a dictionary lookup.
message: midinote X Y [z, ...]
When Y > 0
poly~ seems to store an active-state in a dictionary whose key is X
activeVoices = {}; // some dictionary
activeVoices =
{
X: getInactiveInstance() // X = 60, getInactiveInstance() would return the first inactive instance of a mutemap lookup
}
where getInactiveInstance()
would look at the mute map and return the first instance whose busystate is free (I can't remember if 0 means free or 1 means free, but whatever)
and then assigns that value. i.e.midinote 60 127 ...
activeVoices =
{
60: 1,
}
and routes the full message 60 127 ...
to instance #1
when receiving midinote 60 0
it doesgetActiveInstanceByNote(60)
function getActiveInstanceByNote(note) {
return activeInstances[note]; // 1
}
and relays the message 60 0 ...
to that internal instance, i.e. with max messages to poly~
target {getActiveInstanceByNote(note)}, 60 0 ...
The voice busy-state will be determined by any messaging sent to thispoly~
which often has its inlet connected to an outlet from adsr~
that sends mute messages, or can also do its detection via envelope (averaged~ rms) signal inputs directly to thispoly~
as well.
So if one had to write some voice-allocation & lookup mechanisms... it isn't crazy.
But if we fuck around and look a bit, the poly
object with no tilde already implies the wrapping of most of these mechanisms with most of the lookup value stuff I'm describing exposed as returned values from its outlets.
So you could use poly
(no tilde) to not have to write that stuff I mentioned in javascript or dict
objects or whatever else might be leveraged logic-wise.
Thanks for this thread btw, cheers
creating a custom "poly" in plain max is also not too difficult - and simply required whenever the [poly] external does not fit your needs.
for example this one allows for infinite identical note numbers, which later will be turned off by the same note off command, distributed to all the respective voices which are known to have that note number running.
input:
60 100
66 100
60 100
60 0
output:
1
60 100
2
66 100
3
60 100
1
60 0
3
60 0
inside coll:
60, 1 3
66, 2