<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tracking MIDI notes on multiple channels to handle note offs]]></title><description><![CDATA[<p>I'm working on a MIDI guitar project for disabled musicians that can apply chord changes to a stream of played MIDI notes that correspond to the 6 open strings on a guitar.  So, from my Bela based guitar I get only 6 notes (64 59 55 50 45 40) on 6 channels (2 to 7) along with the velocities, and those notes get transposed to the correct values based on a selected chord. When the string vibration drops below a threshold on the Bela based guitar, it sends the corresponding note with a zero velocity.</p>
<p>This all works fine, but I get stuck notes if a note is playing and there is a chord change before the notes are finished. I need to somehow track the notes that are playing so that when a new note comes in to a particular channel, it will send a zero velocity note to the previous value for that channel.  I've been hammering away trying to figure this out all day and getting nowhere.  I'm not the poly object helps here because I need to keep track of the notes by channel number rather than the arbitrary voice number of poly.</p>
<p>I've been trying to build up and tear down lists on the fly but it is messy and glitchy.</p>
<p>Any recommendations on tracking notes/channels so I can handle the notes off properly?</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 04:53:17 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/15897.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 May 2026 22:55:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tracking MIDI notes on multiple channels to handle note offs on Tue, 26 May 2026 22:55:22 GMT]]></title><description><![CDATA[<p>I'm working on a MIDI guitar project for disabled musicians that can apply chord changes to a stream of played MIDI notes that correspond to the 6 open strings on a guitar.  So, from my Bela based guitar I get only 6 notes (64 59 55 50 45 40) on 6 channels (2 to 7) along with the velocities, and those notes get transposed to the correct values based on a selected chord. When the string vibration drops below a threshold on the Bela based guitar, it sends the corresponding note with a zero velocity.</p>
<p>This all works fine, but I get stuck notes if a note is playing and there is a chord change before the notes are finished. I need to somehow track the notes that are playing so that when a new note comes in to a particular channel, it will send a zero velocity note to the previous value for that channel.  I've been hammering away trying to figure this out all day and getting nowhere.  I'm not the poly object helps here because I need to keep track of the notes by channel number rather than the arbitrary voice number of poly.</p>
<p>I've been trying to build up and tear down lists on the fly but it is messy and glitchy.</p>
<p>Any recommendations on tracking notes/channels so I can handle the notes off properly?</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs</guid><dc:creator><![CDATA[duchamp]]></dc:creator><pubDate>Tue, 26 May 2026 22:55:22 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking MIDI notes on multiple channels to handle note offs on Tue, 26 May 2026 23:43:36 GMT]]></title><description><![CDATA[<p>Hi,<br />
have a look a this [poly] <a href="https://forum.pdpatchrepo.info/topic/5311/polyphonic-voice-management-using-poly" rel="nofollow">tutorial topic</a>.<br />
Nau</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/2</guid><dc:creator><![CDATA[nau]]></dc:creator><pubDate>Tue, 26 May 2026 23:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking MIDI notes on multiple channels to handle note offs on Tue, 02 Jun 2026 23:11:17 GMT]]></title><description><![CDATA[<p>poly doesn't quite work for my case because I need to keep track of which channel the notes are associated. I'm taking MPE in and sending MPE out with only 6 channels of MIDI (one for each string of the guitar)</p>
<p>I'm following up here with the solution I figured out.  I'm now using a &quot;bag&quot; object for each channel that collects all the note on events, and the note offs (zero velocity notes) automatically remove notes because of the way the bag object works.  I can then send a flush message to a specific channel's bag, or all the bags.  This seems to be working very well and I don't get any stuck notes. The note offs are behaving like a guitar with the note offs happen per string/channel.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/3</guid><dc:creator><![CDATA[duchamp]]></dc:creator><pubDate>Tue, 02 Jun 2026 23:11:17 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking MIDI notes on multiple channels to handle note offs on Wed, 03 Jun 2026 02:12:05 GMT]]></title><description><![CDATA[<p>As you noted, [poly] works in the direction of note number --&gt; channel: you give it a note number; it gives you a voice number, or channel; and then when you tell [poly] that you want to release that note number, it will retrieve the channel number.</p>
<p>The catch for your case seems to be &quot;when a new note comes in to a particular channel&quot; -- which sounds like the voice/channel assignment is happening independently of anything [poly] might do.</p>
<p>Does this accurately describe the messaging?</p>
<ol>
<li>Note on, say, f# above middle C = channel 2, note 66, velocity &gt; 0.</li>
<li>New chord overwrites all the strings, including, say g above middle C.
<ul>
<li>g is on the high E string, so f# needs a note off: channel 2, note 66, vel = 0.</li>
<li>Then note 67 gets a note-on.</li>
</ul>
</li>
</ol>
<p>Is that right?</p>
<p>In that case, could you not simply use an array, indexed by channel number? You have a sequential index that's coming in from outside. Arrays operate based on sequential indices. That sounds simpler to me than using a bag.</p>
<p><img src="/uploads/files/1780452197632-pd-guitar-strings.png" alt="pd-guitar-strings.png" class="img-responsive img-markdown" /></p>
<p><a href="/uploads/files/1780452715487-midi-guitar-string-tracker.pd">midi-guitar-string-tracker.pd</a></p>
<p>If I run the message boxes left to right, it prints:</p>
<pre><code>// for 66 64 2:
0 0 2 (note-off: redundant but not harmful)
66 64 2 (ok)

// for 67 64 2:
66 0 2 (note off for preceding pitch on this string, ok)
67 64 2 (ok)

// for 67 0 2:
67 0 2 (ok)
67 0 2 (redundant but not harmful)
</code></pre>
<p>hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/15897/tracking-midi-notes-on-multiple-channels-to-handle-note-offs/4</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Wed, 03 Jun 2026 02:12:05 GMT</pubDate></item></channel></rss>