<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Hi all,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>is note-off-sent-as-zero-velocity-note-on a thing?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Who would?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Is there a particular instrument/controller that typically behaves like this?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Al<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>(who suspects that his MIDI code hasn’t thought of this)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Synth-diy <synth-diy-bounces@synth-diy.org> <b>On Behalf Of </b>Jean-Pierre Desrochers<br><b>Sent:</b> 20 March 2020 01:27<br><b>To:</b> 'dougall' <dougalli@gmail.com>; eidorian@aladan.net<br><b>Cc:</b> Synth-diy@synth-diy.org<br><b>Subject:</b> Re: [sdiy] MIDI I/O c code..<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>></span><span lang=EN-CA> Are you handling running status and note off sent as zero velocity note on?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Yes I handle both.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Running status are ignored here,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>And I consider both NOTE OFF and NOTE ON with zero velocity<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>As the end of a note.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=FR style='font-size:10.0pt;font-family:"Tahoma",sans-serif'>De :</span></b><span lang=FR style='font-size:10.0pt;font-family:"Tahoma",sans-serif'> dougall [<a href="mailto:dougalli@gmail.com">mailto:dougalli@gmail.com</a>] <br><b>Envoyé :</b> 19 mars 2020 21:06<br><b>À :</b> <a href="mailto:eidorian@aladan.net">eidorian@aladan.net</a><br><b>Cc :</b> Jean-Pierre Desrochers; <a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br><b>Objet :</b> Re: [sdiy] MIDI I/O c code..<o:p></o:p></span></p><p class=MsoNormal><span lang=FR-CA><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=FR-CA>Are you handling running status and note off sent as zero velocity note on?<o:p></o:p></span></p><div><p class=MsoNormal><span lang=FR-CA><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=FR-CA>-d<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=FR-CA><o:p> </o:p></span></p><div><div><p class=MsoNormal><span lang=FR-CA>On Fri, 20 Mar 2020 at 11:55, <<a href="mailto:eidorian@aladan.net">eidorian@aladan.net</a>> wrote:<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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:<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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).<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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?<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>Cheers,<br>A.<o:p></o:p></span></p><div id="gmail-m_5822220122528591338signature"><p class=MsoNormal><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>---<o:p></o:p></span></p><div><p class=MsoNormal><span lang=FR-CA style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p></div></div><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p id="gmail-m_5822220122528591338reply-intro"><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>On 20-03-2020 11:14, Jean-Pierre Desrochers wrote:<o:p></o:p></span></p><blockquote style='border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 5.0pt;margin-left:0cm;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><blockquote style='border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 5.0pt;margin-left:0cm;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><p class=MsoNormal><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div></blockquote></blockquote><blockquote style='border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 5.0pt;margin-left:0cm;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div id="gmail-m_5822220122528591338replybody1"><div><div><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>I’m working on a new polyphonic MIDI to CV module (8 voices).<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>So far I did my tests with an old PIC16F887 @ 20Mhz micro I had on hand.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>I use a USART interrupt driven c function to ‘catch’ all the incoming MIDI bytes.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>all the notes are read in the incoming queue but sometimes<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>I get stuck notes or unread ones..<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>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<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>In a receive buffer of 32 bytes and the main () reads and treats them in a FIFO manner<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>Later in the main loop.<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p><p><em><span lang=FR-CA style='font-family:"Verdana",sans-serif'>-Would a 32Mhz micro do a difference in the USART interrupt reading speed ?</span></em><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p></o:p></span></p><p><em><span lang=FR-CA style='font-family:"Verdana",sans-serif'>-And is 32 bytes long enough for the RxBuffer to handle a 6 voices chords ?</span></em><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p></o:p></span></p><p><em><span lang=FR-CA style='font-family:"Verdana",sans-serif'>-And finaly I checked the web for a ‘decent’ C code examples</span></em><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p></o:p></span></p><p><em><span lang=FR-CA style='font-family:"Verdana",sans-serif'> for MIDI reception (MIDI Tx is much easier to implement) with no success..</span></em><i><span lang=FR-CA style='font-family:"Verdana",sans-serif'><br><em><span style='font-family:"Verdana",sans-serif'> ‘Obscure’ Arduino libraries all around with no explainations of its inner code.</span></em></span></i><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>Did anybody use good C code available ?<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'>JP<o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p><p><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><a href="mailto:Synth-diy@synth-diy.org" target="_blank">Synth-diy@synth-diy.org</a><o:p></o:p></span></p></div></div></div><p class=MsoNormal><span lang=FR-CA style='font-size:10.0pt;font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=FR-CA style='font-size:10.0pt;font-family:"Courier New"'>_______________________________________________<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" target="_blank">http://synth-diy.org/mailman/listinfo/synth-diy</a><o:p></o:p></span></p></div></blockquote></div><p class=MsoNormal><span lang=FR-CA>_______________________________________________<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" target="_blank">http://synth-diy.org/mailman/listinfo/synth-diy</a><o:p></o:p></span></p></blockquote></div></div></body></html>