I couldn't resist creating my own approach.

I used a table with 2048 entries and just store the velocity for each note, I add 128 * channel number to each note number to achieve multiple channels.

In order to find which notes are down you just see which entries in the table are greater than 0.

-Alex

On Tue, Nov 11, 2014 at 6:40 PM, JC Pedroza <nemesis4go10@hotmail.com> wrote:
I finally solved this. 

Used a combination of [list-extend], [list-find], [list-delete] for the list dynamics and [notein] for MIDI input. The patch first separates the MIDI note messages by velocity (0 velocity is note-off). If note-on then it adds the note to the list, if note-off it removes the note from the list. 

When the patch receives a bang, it outputs the list with all the keys (MIDI notes) that are being pressed.

I'm including the patch as attachment. You can also get it at: http://raw.githubusercontent.com/JCPedroza/puredata/master/tools/MIDI_io/list-MIDInoteon.pd

There are two important subpatches. [pd on_off_route] routes the MIDI-note-on notes to one side, and MIDI-note-off notes to the other. [pd list-deletevalue] deletes a value from a given list, outputs the list unchanged if the value was not found.

It surely can be improved. Let me know if you find something. 

Thanks everyone for your time and help, I really appreciate it. 

----------------------------------------
> From: ingo@miamiwave.com
> To: nemesis4go10@hotmail.com; pd-list@lists.iem.at
> Subject: AW: [PD] How to add/remove MIDI notes from a list using MIDI in and note on/off?
> Date: Tue, 11 Nov 2014 14:43:33 +0100
>
> If you are on Pd-extended I would suggest using [cyclone/coll].
> That's what I am using. Much easier than working with regular lists.
>
> Ingo
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Pd-list [mailto:pd-list-bounces@lists.iem.at] Im Auftrag von JC
>> Pedroza
>> Gesendet: Dienstag, 11. November 2014 13:54
>> An: pd-list@lists.iem.at
>> Betreff: [PD] How to add/remove MIDI notes from a list using MIDI in and
>> note on/off?
>>
>> I need to populate a list with the MIDI notes that are being pressed, and
>> remove the note from the list when the key is released.
>>
>> One idea is to use [notein], and if the velocity is> 0 then add the note
>> to the list, and if the velocity == 0 then remove the note from the list.
>> But I have no idea of how to implement this.
>>
>> I think I need [list-extend], [list-find], and [list-delete], but I just
>> can't figure out an implementation.
>>
>> How can I do this?
>> _______________________________________________
>> Pd-list@lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
                                         

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list