I have used the poly object to route the midi notes to voices in order to have polyphony. I am constructing a patch like piano so I use pedals also. I've program the right pedal to cut the velocity 0 message, when it is pressed, in order to have a sustain sound. The problem is that when I repeat a note in the keyboard the route object gives to the same midi note other voice numbers so the same note goes to different voices. I want the same note to remain in the same voice number (note in-note off, or note on-note on without note off). Is there a way for poly object to do such a thing or I have to program every note correspond to a voice sub-patch? Thanx anyone who will help in advance!
-
Serious problem with poly object!!
-
when the pedal s pressed, you need to store the note value in the right inlet of a float. then, when the pedal is released, you can bang that float and create a note message with the stored value and a velocity of 0.
-
You can also accumulate all note-offs in a
and send them out when the pedal is released. Check the attached patch, it should give you some ideas
-
Your patch is very useful Maelstrom but it has one problem: it saves the note off messages and when the pedal is released it send all the notes off. But when I press a note twice and I want it to be sustained by finger and release the pedal then the pedal gives all notes off and the finger sustain doesn't work. That is problem because in a normal piano there is this mechanism for this and I want it to. Is there a way that the notes witch haven't sent a note off message (finger sustain) to be excepted from the final note off list? Thanks again for your precious help!
-
@skatias said:
But when I press a note twice and I want it to be sustained by finger and release the pedal then the pedal gives all notes off and the finger sustain doesn't work.
I don't think that should happen unless the previous note has been stolen. But if it is the case, you might want to consider handling this inside the voice itself. I don't have time to make an example right now, but I'll try to explain. Right now I imagine it's set up to go into its release stage when it receives a velocity 0. You could put a [ctlin] inside the voice and have it do a check for whether or not the sustain pedal is down when it receives velocity 0. If it is, have it wait for the pedal to be released before going into the release stage, otherwise let it pass. This should definitely prevent new voices from being turned off.
As for making sure a specific note isn't duplicated, you'll have to keep a running track of what notes have been sent to what voice. Here's what I'm thinking: for every note-on/note-off coming out of [poly], store the note value in a table that's the same length as the number of voices. Use [poly]'s voice number as the table index, and for every note-on store the note number, and for note-offs store something out of range like -1. When a new note-on comes through, run a quick check through the table to see if the same pitch is being used before [route]ing it. If it finds a match, change the voice number to the table index so that it goes to the same voice and retrigger the note, making sure to reset it if it's being held by the sustain pedal.
Or something like that.
-
Try this, I think it works.