[PD] Midi note handling for monophonic synth
Claude Heiland-Allen
claude at goto10.org
Thu Apr 21 14:27:26 CEST 2011
Hi Joe,
On 21/04/11 12:48, Joe White wrote:
> Hi all,
>
> I'm implementing a synth in Pd using midi/notein as an input.
>
> One problem I keep coming up against is handling note off messages. This
> guy's blog post describes the issue -
> http://kemptonmooney.com/2010/09/pure-data-midi-note-off-solution/
>
> However, I think his solution is not exactly what I'm looking for. The
> synths I use in Logic have note priority methods and remember all held down
> notes (or at least 10).
If pitch is the only thing determining which notes should sound, you
could use a [table $0-active 128] (one index for each MIDI note) to
count how many times each note has been pressed and not released, then
process it how you like.
If the order of key presses matters, you could keep an ordered list of
pressed notes (example below using Haskell to prototype the algorithm)
and sound the most recently pressed note that hasn't been released:
----8<----
$ ghci
...
> let soundingNote = listToMaybe
> let noteOn note vel notes = (note, vel) : notes
> let noteOff note vel notes = deleteBy ((==)`on`fst) (note, vel) notes
> let noNotes = []
> let test = noteOff 62 60 . noteOn 60 60 . noteOn 62 60 $ noNotes
> soundingNote test
Just (60,60)
> soundingNote (noteOff 60 25 test)
Nothing
----8<----
> I wondering if anyone has managed to implement something like this in Pd or
> might know where I can find out more about it.
Might be something more directly useful in the previous discussions:
http://lists.puredata.info/search/Pd-list?query=monophonic&max=100&result=normal&sort=score
Claude
--
http://claudiusmaximus.goto10.org
More information about the Pd-list
mailing list