<meta charset="utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Hi Claude,</span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Thanks for the info, how are you searching the list btw?</span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><meta charset="utf-8"><div>

Found this in the search you linked: </div><div><br></div><div>&quot;<span class="Apple-style-span" style="font-family: monospace; white-space: pre; border-collapse: separate; font-size: medium; ">i coded two simple externals that do the job (and tell you the gate </span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; border-collapse: separate; font-size: medium; ">status also, eg. if there are notes pressed or not). you can find on my </span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; border-collapse: separate; font-size: medium; ">(under construction) website <a href="http://xaero.ath.cx/cms/software">http://xaero.ath.cx/cms/software</a>&#39;</span></div>

<span class="Apple-style-span" style="border-collapse: separate; font-family: Times; font-size: medium; "><pre><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; white-space: normal; ">It&#39;s sod&#39;s law that the link is broken :(</span></pre>

</span></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">&gt; If the order of key presses matters, you could keep an ordered list of<br>
</span>&gt; pressed notes (example below using Haskell to prototype the algorithm)<br>
&gt; and sound the most recently pressed note that hasn&#39;t been released:</div><div><br></div><div>This exactly what I want, although I don&#39;t know Haskell at all, sorry. I can keep an ordered list with just one item, however, using item pairs (pitch, velocity) gets more difficult with how Pd handles commas (i&#39;m assuming comma is the best way to keep a separated list). </div>

<div><br></div><div>Thanks for the help,</div><div>Joe</div><div><br></div><meta charset="utf-8">Message: 3<br>Date: Thu, 21 Apr 2011 13:27:26 +0100<br>From: Claude Heiland-Allen &lt;<a href="mailto:claude@goto10.org" style="color: rgb(51, 51, 204); ">claude@goto10.org</a>&gt;<br>

Subject: Re: [PD] Midi note handling for monophonic synth<br>To: <a href="mailto:pd-list@iem.at" style="color: rgb(51, 51, 204); ">pd-list@iem.at</a><br>Message-ID: &lt;<a href="mailto:4DB022AE.9010208@goto10.org" style="color: rgb(51, 51, 204); ">4DB022AE.9010208@goto10.org</a>&gt;<br>

Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br><br>Hi Joe,<br><br>On 21/04/11 12:48, Joe White wrote:<br>&gt; Hi all,<br>&gt;<br>&gt; I&#39;m implementing a synth in Pd using midi/notein as an input.<br>&gt;<br>

&gt; One problem I keep coming up against is handling note off messages. This<br>&gt; guy&#39;s blog post describes the issue -<br>&gt; <a href="http://kemptonmooney.com/2010/09/pure-data-midi-note-off-solution/" target="_blank" style="color: rgb(51, 51, 204); ">http://kemptonmooney.com/2010/09/pure-data-midi-note-off-solution/</a><br>

&gt;<br>&gt; However, I think his solution is not exactly what I&#39;m looking for. The<br>&gt; synths I use in Logic have note priority methods and remember all held down<br>&gt; notes (or at least 10).<br><br>If pitch is the only thing determining which notes should sound, you<br>

could use a [table $0-active 128] (one index for each MIDI note) to<br>count how many times each note has been pressed and not released, then<br>process it how you like.<br><br>If the order of key presses matters, you could keep an ordered list of<br>

pressed notes (example below using Haskell to prototype the algorithm)<br>and sound the most recently pressed note that hasn&#39;t been released:<br><br>----8&lt;----<br>$ ghci<br>...<br> &gt; let soundingNote = listToMaybe<br>

 &gt; let noteOn note vel notes = (note, vel) : notes<br> &gt; let noteOff note vel notes = deleteBy ((==)`on`fst) (note, vel) notes<br> &gt; let noNotes = []<br> &gt; let test = noteOff 62 60 . noteOn 60 60 . noteOn 62 60 $ noNotes<br>

 &gt; soundingNote test<br>Just (60,60)<br> &gt; soundingNote (noteOff 60 25 test)<br>Nothing<br>----8&lt;----<br><br>&gt; I wondering if anyone has managed to implement something like this in Pd or<br>&gt; might know where I can find out more about it.<br>

<br>Might be something more directly useful in the previous discussions:<br><br><a href="http://lists.puredata.info/search/Pd-list?query=monophonic&amp;max=100&amp;result=normal&amp;sort=score" target="_blank" style="color: rgb(51, 51, 204); ">http://lists.puredata.info/search/Pd-list?query=monophonic&amp;max=100&amp;result=normal&amp;sort=score</a><br>

<br><br>Claude<br>--<br><a href="http://claudiusmaximus.goto10.org/" target="_blank" style="color: rgb(51, 51, 204); ">http://claudiusmaximus.goto10.org</a></span>