<?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[MIDI Synth Unit (SAM2695) - assigning different voices to different channels.]]></title><description><![CDATA[<p dir="auto">I just got my hands on the <a href="https://shop.m5stack.com/products/midi-synthesizer-unit-sam2695" target="_blank" rel="noopener noreferrer nofollow ugc">M5 SAM2695 unit</a>, which I think is super fun.</p>
<p dir="auto">I've stumbled upon an issue which I'd hope the community could help me with.<br />
Namely, I would expect the following sequence of MIDI events:</p>
<pre><code>ProgramChange(patch=&lt;instrument A&gt;, channel=0)
ProgramChange(patch=&lt;instrument B&gt;, channel=1)
NoteOn(channel=0, note=60)
NoteOn(channel=1, note=64)
</code></pre>
<p dir="auto">To play the first note using instrument A and the second using instrument B. Instead, however, it seems to play both notes using whatever instrument was used in the most recent call to ProgramChange, irrespectively of any channel numbers.</p>
<p dir="auto">Am I misunderstanding the MIDI API, do I need to set some configuration setting for SAM2695 specifically, or is it a bug in the API implementation of the SAM2695?</p>
<p dir="auto">I am using CircuitPython (on an AtomS3 Lite) with Adafruit's MIDI library (which seems to send the right commands). Here's an actual code example:</p>
<pre><code class="language-python">import board
import busio
import time

import adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff
from adafruit_midi.program_change import ProgramChange
from adafruit_midi.system_exclusive import SystemExclusive

uart = busio.UART(tx=board.D2, baudrate=31250, bits=8, parity=None, stop=1)
midi = adafruit_midi.MIDI(midi_out=uart, out_channel=0)

midi.send(SystemExclusive([0x7e, 0x7f], [0x09, 0x01])) # Reset
midi.send(SystemExclusive([0x7f, 0x7f, 0x04], [0x01, 0x00, 123 &amp; 0x7f])) # Volume 123

midi.send(ProgramChange(patch=108, channel=0)) # Kalimba
midi.send(ProgramChange(patch=0, channel=1)) # Piano
# I'd expect to hear first Kalimba then Piano
# but both notes are played using Piano
midi.send(NoteOn(channel=0, note=60))
time.sleep(0.5)
midi.send(NoteOn(channel=1, note=64))
time.sleep(1)

# Same PC events, just in different order
midi.send(ProgramChange(patch=0, channel=1)) # Piano
midi.send(ProgramChange(patch=108, channel=0)) # Kalimba
# Now both are played using Kalimba
midi.send(NoteOn(channel=0, note=60))
time.sleep(0.5)
midi.send(NoteOn(channel=1, note=64))
</code></pre>
<p dir="auto">I went through the <a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/products/unit/Unit-Synth/SAM2695.pdf" target="_blank" rel="noopener noreferrer nofollow ugc">datasheet</a> as well as I could but did not find anything helpful yet.</p>
]]></description><link>https://community.m5stack.com/topic/6071/midi-synth-unit-sam2695-assigning-different-voices-to-different-channels</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 06:43:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6071.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Feb 2024 10:12:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MIDI Synth Unit (SAM2695) - assigning different voices to different channels. on Fri, 09 Feb 2024 11:51:47 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for working it out and sharing your results</p>
]]></description><link>https://community.m5stack.com/post/23723</link><guid isPermaLink="true">https://community.m5stack.com/post/23723</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 09 Feb 2024 11:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to MIDI Synth Unit (SAM2695) - assigning different voices to different channels. on Fri, 09 Feb 2024 12:01:17 GMT]]></title><description><![CDATA[<p dir="auto">OK, I figured it out, the problem was due to Adafruit's library <a href="https://github.com/adafruit/Adafruit_CircuitPython_MIDI/issues/56" target="_blank" rel="noopener noreferrer nofollow ugc">strange decision</a> to <a href="https://github.com/adafruit/Adafruit_CircuitPython_MIDI/blob/main/adafruit_midi/__init__.py#L155" target="_blank" rel="noopener noreferrer nofollow ugc">overwrite</a> the <code>channel</code> field of the message in the <code>send</code> method by its own parameter.</p>
<p dir="auto">So,</p>
<pre><code class="language-python">midi.send(SomeMessage(..., channel=X))
</code></pre>
<p dir="auto">should always be used as</p>
<pre><code class="language-python">midi.send(SomeMessage(...), channel=X)
</code></pre>
<p dir="auto">instead. Then everything works as intended.</p>
]]></description><link>https://community.m5stack.com/post/23722</link><guid isPermaLink="true">https://community.m5stack.com/post/23722</guid><dc:creator><![CDATA[konstantint]]></dc:creator><pubDate>Fri, 09 Feb 2024 12:01:17 GMT</pubDate></item></channel></rss>