[PD] How to add/remove MIDI notes from a list using MIDI in and note on/off?
nemesis4go10 at hotmail.com
Wed Nov 12 03:40:24 CET 2014
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 at miamiwave.com
> To: nemesis4go10 at hotmail.com; pd-list at 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.
>> -----Ursprüngliche Nachricht-----
>> Von: Pd-list [mailto:pd-list-bounces at lists.iem.at] Im Auftrag von JC
>> Gesendet: Dienstag, 11. November 2014 13:54
>> An: pd-list at 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 at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2594 bytes
Desc: not available
More information about the Pd-list