<div dir="ltr">Are you handling running status and note off sent as zero velocity note on?<div><br></div><div>-d</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 20 Mar 2020 at 11:55, <<a href="mailto:eidorian@aladan.net">eidorian@aladan.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Sorry, I don't have example code for you, but here is some analysis that I hope might help point you in the right direction:</p>
<p>20MHz / 31,250Hz => ~640 instructions per MIDI data bit, or 6,400 instructions per MIDI data byte.  That's quite a lot of instruction execution time between notes, so I'd be checking the efficiency/optimisation of the code.</p>
<p>How long is it taking to update the analog outputs and do other processing?  If it's updating all 8 CVs via a "slow" protocol like I2C every time it loops then that might be taking a while, and maybe you need a different approach (i.e. only update a CV output when it changes).</p>
<p>How have you implemented the FIFO?  Do you have locking to ensure the interrupt isn't writing to it while the main loop is updating it?</p>
<p>Create a debug version that has checks on the FIFO size in the interrupt, and sets an LED on if it overflows, so you can confirm for certainly whether or not that's the problem.</p>
<p>What I do (with 30+ years of programming experience) is pretend I'm the CPU, and "execute" the code in my head (or on paper if complex) in order to try to work out what unplanned or unexpected things might be happening to cause the problematic behaviour.</p>
<p>Cheers,<br>A.</p>
<div id="gmail-m_5822220122528591338signature">---<br>
<div style="margin:0px;padding:0px;font-family:monospace"> </div>
</div>
<p><br></p>
<p id="gmail-m_5822220122528591338reply-intro">On 20-03-2020 11:14, Jean-Pierre Desrochers wrote:</p>
<blockquote type="cite" style="padding:0px 0.4em;border-left:2px solid rgb(16,16,255);margin:0px">
<blockquote type="cite" style="padding:0px 0.4em;border-left:2px solid rgb(16,16,255);margin:0px">
<div> </div>
</blockquote>
</blockquote>

<blockquote type="cite" style="padding:0px 0.4em;border-left:2px solid rgb(16,16,255);margin:0px">
<div id="gmail-m_5822220122528591338replybody1">
<div lang="FR-CA">
<div>
<p><span>I’m working on a new polyphonic MIDI to CV module (8 voices).</span></p>
<p><span>So far I did my tests with an old PIC16F887 @ 20Mhz micro I had on hand.</span></p>
<p><span>I use a USART interrupt driven c function to ‘catch’ all the incoming MIDI bytes.</span></p>
<p><span>My code is pretty fast, but still, since I only read one MIDI channel (1-16) at the time <br>when I play very fast chords on an external keyboard</span></p>
<p><span>all the notes are read in the incoming queue but sometimes</span></p>
<p><span>I get stuck notes or unread ones..</span></p>
<p><span>Same thing happens when playing MIDI files on Cakewalk SONAR <br>feeding my prototype with  a MIDI cable.<br>The interrupt function grabs each incoming byte and put them</span></p>
<p><span>In a receive buffer of 32 bytes and the main () reads and treats them in a FIFO manner</span></p>
<p><span>Later in the main loop.</span></p>
<p><span> </span></p>
<p><em><span style="font-size:12pt">-Would a 32Mhz micro do a difference in the USART interrupt reading speed ?</span></em></p>
<p><em><span style="font-size:12pt">-And is 32 bytes long enough for the RxBuffer to handle a 6 voices chords ?</span></em></p>
<p><em><span style="font-size:12pt">-And finaly I checked the web for a ‘decent’ C code examples</span></em></p>
<p><em><span style="font-size:12pt">  for MIDI reception (MIDI Tx is much easier to implement) with no success..<br>  ‘Obscure’ Arduino libraries all around with no explainations of its inner code.</span></em></p>
<p><span> </span></p>
<p><span>Did anybody use good C code available ?</span></p>
<p><span>JP</span></p>
<p> </p>
<p><a href="mailto:Synth-diy@synth-diy.org" target="_blank">Synth-diy@synth-diy.org</a></p>
</div>
</div>
</div>
<br>
<div style="margin:0px;padding:0px;font-family:monospace">_______________________________________________<br>Synth-diy mailing list<br><a href="mailto:Synth-diy@synth-diy.org" target="_blank">Synth-diy@synth-diy.org</a><br><a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noopener noreferrer" target="_blank">http://synth-diy.org/mailman/listinfo/synth-diy</a></div>
</blockquote>
</div>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org" target="_blank">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/listinfo/synth-diy</a><br>
</blockquote></div>