How does one unpack a chord into the separate (note ) values ?
Since a chord is essentialy multiple messages send in serial order , the unpack is of no use ( it unpacks a single note +velo )
An object with a time interval between incomming messages would solve it , but I cant't find any
-
I need an object to unpack an incoming midi chord (midi in, note in )
-
@gentleclockdivider [poly] I think..... + [clone] for the synth.
https://forum.pdpatchrepo.info/topic/14281/playing-chords-via-midi/3
There was, and may still be, an external in the maxlib library.... [chord xx].
David.
-
So just using pd vanilla objects won't cut it ?
Edit , I mean poly is part of vanilla but I have hard time how to set it up to seperate the incoming notes ( chord ) -
[mkmr] is a collection of vanilla abstractions & could definetly see some way to use the arppegiator and chop out the arp stuff and focus on an object that routes and unpacks them all out, itd be easier to decide ahead on a max amount of notes to unpack like 10 and then build it for that
(https://github.com/MikeMorenoDSP/pd-mkmr/tree/master/sequencers) its here but you can just install all of his stuff using deken aka "find externals"
-
@gentleclockdivider You should post your incoming message, as there is no such thing as a chord in midi.
It is likely that it is a series of note velocity pairs arriving in a fast sequence.
If so, then [poly] and [clone].
If not there will be a solution, but we cannot help without knowing the problem.
David. -
@whale-av said:
@gentleclockdivider You should post your incoming message, as there is no such thing as a chord in midi.
It is likely that it is a series of note velocity pairs arriving in a fast sequence.
If so, then [poly] and [clone].
If not there will be a solution, but we cannot help without knowing the problem.
David.Did you read my first post ?
I am aware that midi is a serial protocol and chords are just separate notes send after each other
-quote-
Since a chord is essentialy multiple messages send in serial order
-unquote-
Let's recap , a chord ( thus separate incoming midi notes perceived as a chord ) goes into pure data , I want to extract the midi note values .
UNpack -only unpacks last received note+velocity , that's why I wrote that an object that detects the time between incoming events could be the solution .
SO let's say I play a simple c min (midiin) , which has the midi note nr's 48 , 51 , 55 ....I want these these to appear in separate numboxes .
-
The borax object gives all the info ,nr of note on's that are held , timing between notes ( chord remember ) and the note nr ( again only the last one in the stream ).
There has to be some kind of module that stores all the incoming-separate notes so we can then later extract the note valuesThe first part of this video shows exactly what I am dealing with , max msp has an object called quicktresh which detect all the incoming notes ( if played fast like a chord ) and shows the notes numbers .
This object probably uses an internal timer to seperate the incoming notes , hence see my first post why I think such an object would solve my problem
So ..how to do this in pure data ?
-
In addition to time thresholding, you could also look for overlapping notes -- if you get 5 note-ons without any matching note-offs, then all 5 notes are held together = chord.
So which would you prefer?
hjh
-
This post is deleted!
-
Here's a pure-vanilla simple threshold (like quickthresh but simpler).
The threshold is currently hard-coded in the [moses] and [delay] objects. You could add a control to change it.
hjh
-
And the overlapping-notes approach. This one updates the list for every note on/off.
[pd delete] is basically:
newlist = List.new; i = 0; while(i < list.size) { if(list[i] != notenum) { newlist.add(list[i]); }; i = i + 1; }; return newlist;
(Or in SuperCollider,
list = list.select(_ != notenum)
)hjh
-
@gentleclockdivider "Let's recap , a chord ( thus separate incoming midi notes perceived as a chord ) goes into pure data , I want to extract the midi note values .
UNpack -only unpacks last received note+velocity , that's why I wrote that an object that detects the time between incoming events could be the solution .
SO let's say I play a simple c min (midiin) , which has the midi note nr's 48 , 51 , 55 ....I want these these to appear in separate numboxes ."[unpack] produces all the note numbers...... but you only see the last..... a [print] will show them.
As I said at the start of this thread, [poly] will separate them for you as it indexes the notes.
You could then use [route] to separate them but [clone] is more useful as you can clone a synth inside if you wish.
The indexes from [poly] can be used to allocate the notes to the clones, and [poly] then ensures that you have no hanging notes as the noteoff messages are allocated the same index.As the idea of a chord is human and has no meaning in Pd, midi, or even on a keyboard, why would you need to group the notes together with a timer or a threshold.... I am just curious...
To correct bad keyboard technique...?The method using [poly] and [route] is shown in your Pd/doc folder....... Pd/doc/7.stuff/synth/1.poly.synth.pd .... since at least 2011.
David. -
Thanks ,
And how would one do it with the poly object ( if possible ) ? -
@whale-av said:
@gentleclockdivider "Let's recap , a chord ( thus separate incoming midi notes perceived as a chord ) goes into pure data , I want to extract the midi note values .
UNpack -only unpacks last received note+velocity , that's why I wrote that an object that detects the time between incoming events could be the solution .
SO let's say I play a simple c min (midiin) , which has the midi note nr's 48 , 51 , 55 ....I want these these to appear in separate numboxes ."[unpack] produces all the note numbers...... but you only see the last..... a [print] will show them.
As I said at the start of this thread, [poly] will separate them for you as it indexes the notes.
You could then use [route] to separate them but [clone] is more useful as you can clone a synth inside if you wish.
The indexes from [poly] can be used to allocate the notes to the clones, and [poly] then ensures that you have no hanging notes as the noteoff messages are allocated the same index.As the idea of a chord is human and has no meaning in Pd, midi, or even on a keyboard, why would you need to group the notes together with a timer or a threshold.... I am just curious...
To correct bad keyboard technique...?The method using [poly] and [route] is shown in your Pd/doc folder....... Pd/doc/7.stuff/synth/1.poly.synth.pd .... since at least 2011.
David.I reall think we have a communication error here .
I know that a chord does not exist in pure data -midi etc...and that it's a sequential message of single notes , I have expresed that in my first post .
I am also aware that only the last of the messages is shown by the unpack module .- quote-
As the idea of a chord is human and has no meaning in Pd, midi, or even on a keyboard, why would you need to group the notes together with a timer or a threshold.... I am just curious...
To correct bad keyboard technique...?
-unquote -
Bad keyboard technique ??
I just wanted pure data to SHOW all incoming midi notes that make up the chord , not in the console but in the structure view ., , your treshold value example did that .
Why is it so bizarre to ask for that , max msp has a dedicated object for exactly that , says enough . -
@gentleclockdivider This is becoming perhaps a bit heated, unnecessarily?
I guess part of the confusion is that there are two purposes being discussed. One is display ("show all incoming midi notes that make up the chord"). The other is performing the notes as audio.
whale-av is correct that if you want to play the notes audibly, it's easier not to pack the note numbers into a single list.
- Note performance, approach 1: Notes come in --> play them polyphonically.
- Note performance, approach 2: Notes come in --> pack the note numbers into a list --> unpack the list --> play the notes polyphonically.
whale-av was trying to caution you against the second approach for audio performance. Those comments were not addressing the problem of display.
For display, I gave you a couple of examples (btw those examples were mine, not whale-av's, proper credit), so that problem is solved, I think.
max msp has a dedicated object for exactly that , says enough .
As shown, it's possible to do using core Pd objects.
If you replace the [notein] at the top with a pair of inlets (note number and velocity), and put an outlet at the end, you can save it as an abstraction and then you have a dedicated object. You could even add a list box in a graph-on-parent zone and get built-in display.
hjh
-
Yes , indeed confusing .
I never brought up the second discussion , I was only interested in display of the chords
I know how to make abstractions ,
Thanks all fo the suggestions -
@gentleclockdivider I am sorry that I misunderstood, but you didn't ask for that In your OP as you asked for separate note values, and in your second post, and in your third, even though they are already separate, and so I assumed wrongly that you needed to process those separate values.
It was not until your 4th post that you asked to group the chord notes together.
Please be more precise with your questions.
We always try to help. That is the sole purpose of this forum.
David.