Hi to all!
I was looking for a way to sort incoming midi values so as to use them in 4 different monophonic legato instruments (from bottom to top, a cello, a viola, and 2 violins). How can I go about sorting the incoming midi note values so as to automatically arrange the lowest voice with the cello, next voice viola, next violin II and next violin I? There are a couple of problems regarding note on or of that come to mind... but i'm not really sure. Any help is appreciated.
Thanks in advance.
-
Sorting 4 midi note numbers to 4 different instruments
-
@ChicoVaca Only done for 3....... but easily expandable and then adjustable through the [moses] arguments....
Something like this....... this.pd
You only really need one [f] but its easier to copy the whole block.If you are using chords then you will need a [poly] on the output of each block.
David,
-
Thanks for your answer! If I understand it properly, that would make 3 registers, right? one from keys 0 to 40, the other from 40 to 60 and the last from 60 to 80. But what if I play... let's say 3 note chords... and regardless of the register I would like to sort them out so as to instrument 1 always gets the lowest note, instr. 2 the mid one instr. 3 the highest. Is that possible? Wouldn't I have to make a list with the three values and then sort them?
-
@ChicoVaca Yes.... but 0-39, 40-59, 60-79.... then the right outlet of [moses 80] 80+.
Anything will be possible....... but that will take some thought.
The patch I posted will take a chord and play it except that if more than one note of the chord falls into the same register you will need multiple players and [poly] to keep track of the notes....... like this with a player in place of each [print]....
I say anything is possible, but in order for Pd to know that it is a chord that has arrived at [notein] a time window would need to be set...... i.e. this note +that +that in 500ms is a chord.. because there is no such midi message as a chord... it is just a string of note on messages and then note off messages when the keys are released.
That would then allow you to make the list with the 3 notes and sort them.But that will introduce maybe unacceptable latency.
A round-robin approach would work, but you would have to always play 3 note chords and if a note was missed the order of the instruments would be shifted.As I said... it needs some thought..... probably a lot.....
David. -
@ChicoVaca Yes -- whale-av is right about the problem. It's possible to collect, but the only way to know that the chord is over is to wait a short time.
This handles note-on. It will not remove notes from the chord upon note-off (which is easy in a programming language but rather laborious in patching -- not impossible, just cumbersome, and I'm short on time).
Every time a note is appended to the list, it also triggers a 50 ms delay. [delay] only fires the last one -- so if you play C 60 and E 64 quickly, the [delay] will fire only 50 ms after the second note, causing the list to be output.
hjh
-
Thanks you both for your answers!
@whale-av said:
A round-robin approach would work, but you would have to always play 3 note chords and if a note was missed the order of the instruments would be shifted.
Yeah. I was afraid of something like that... Would this be something like {poly]?
I think what I want is pretty difficult to solve. I just want to be able to play a couple of monophonic instruments as an ensamble that plays the legato nicely without interfering a voice with each other.For example... let's say I wanted to play 2 different monophonic legato instruments. Legato implies the pressing of two keys... two keys per voice. Those keys per voice are not even played together, because timings of the music. And the two voices play together or not depending of the playing style (that is, 2 voices have the same rhythm or are rhythmically independent of each other).
Just thinking out loud to see if I'm getting this right:
If you play just two note chords (same rhythm), that means 4 notes need to be played for legato to be produced, right? 2 notes per voice. If you want the voices to be orderer from lower to higher without crossings, the sequence would be:
- you would first have to order the inicial 2 notes, with the delay time to play/order that you pointed out. That gives you ordered list A.
- you would then have to play and order the 2 other notes, with delay time to play/process. That gives you ordered list B.
- with that, you would have to make so as to the lowest note from list B midi-chokes the lowest one from list A. Same with higher note.
- A little time after (as 2 notes that want to play legato must superpose), you would have to send a velocity 0 message to the notes from list A.
I can't think of a way of doing pretty much all of this... and this is just the simplest (same rhythm) case.
-
@ChicoVaca I will try to understand all that, but I am not a musician.
I suggest that you type into google .... pdpatchrepo legato
There have been quite a few discussions in the past and you might find a solution...
David. -
@ChicoVaca This sort of thing can work if you accept some sacrifices, you adapt your playing to the system and devise the system around your playing. So you won't be able to improvise with it in the way you normally would but you can still improvise, the system just becomes a part of your instrument and like all instruments has its own unique limitations and strengths and we can redefine that system while we play. I roughly outlined my method for such things in this thread, if I have time this weekend I will go into more depth and provide a simple example. [pdlua] in some ways is a better way to go than my little interpreters that I endlessly patch together and certainly more efficient but does not really work as well with the pd way of doing things, does not integrate as tightly.
-
@whale-av said:
@ChicoVaca I will try to understand all that, but I am not a musician.
I suggest that you type into google .... pdpatchrepo legatoOh I'm sorry... I come from a composition background. I tried to make it simple and I guess I failed. Thanks for bearing with me . I was mainly talking about the way legato instruments (synths, VSTis, etc.) play, like you have to play first a note and hold it, then press the other one and it makes the legato transition.
-
@oid This sound very interesting to me, as soon as I have time I'll read your post! Don't know a lot of PdLua though... just some of Lua. If you have the time, I'll be waiting for your update then. Thank you all for your answers!
-
@ChicoVaca While patching up something using my DSL method it led me to an idea. If you are free to use both hands for playing the strings we can split the keyboard and use the left hand for control and some changes and just let the right hand play the chord and always expect 4 notes from that chord, this means we can skip the delay completely and just have it trigger everytime it gets 4 notes. Quick proof of concept
So any note over 60 gets stored in the [text] in the order received so you have to play the notes in the order you want them to go to the voice, on the fourth notes it sends them to each voice. If you only want to play two notes or just change two you pad the list as needed with dummy notes, anything with a velocity under 10 sets velocity to zero, noteoff. or you can use that to tweak the volume of playing notes in the case of just wanting to change what two notes are playing. Since it only fires on the 4th note you can preload the first 3 and just hit the 4th at the appropriate time. Left hand has notes 32, 33, 34, and 35 being used to select an individual voice, and key pressed between 36-60 will be sent to that voice. Left hand for control could be developed further to add quite a bit of control including programming speed of glissando with velocity, toggling between pizzicato and legato on a per voice basis or to calculate glissando per voice (best guess and would require adding timing data to the [text]) all depending on what you are after and how much you are willing/able to adapt your playing technique.
stringthing.pdEdit: Uploaded the wrong version of the patch, fixed. After playing with it some, I think I would just have the right hand do 3 notes any time one voice is selected for tweaking with the left hand, end result is more dynamic that way and it is a bit easier to adapt to. Works quite well that way if you also have aftertouch.
Another Edit: Fixed a stupid mistake.