{"id":680,"date":"2009-12-17T01:09:20","date_gmt":"2009-12-17T05:09:20","guid":{"rendered":"http:\/\/www.glacialcommunications.com\/news\/?p=680"},"modified":"2009-12-17T01:09:20","modified_gmt":"2009-12-17T05:09:20","slug":"arduino-trigger-to-midi-converter","status":"publish","type":"post","link":"https:\/\/www.glacialcommunications.com\/news\/2009\/12\/arduino-trigger-to-midi-converter\/","title":{"rendered":"Arduino Trigger-to-MIDI converter"},"content":{"rendered":"<p>OK, the trigger-to-MIDI clock converter seems relatively happy (though I think the MIDI in on my AN200 isn&#8217;t? That&#8217;s going to require some more tests&#8230;).<\/p>\n<p>I hacked on it a bit tonight trying to determine how drifty the generated MIDI clock was relative to the incoming trigger pulses from the DR-110.\u00c2\u00a0 At first it was pretty ugly. I then added some compensation to the clocking to account for all of the work the Arduino is doing. After some trial-and-error, it&#8217;s relatively tight &#8211; total drift by my rough calculations was something like 10 milliseconds over a five minute period. Compare that to an earlier drift of 120 ms in a minute&#8230;<\/p>\n<p>Here&#8217;s the code: <a href=\"http:\/\/www.glacialcommunications.com\/src\/trigger2midisync.pde\">trigger2midisync.pde<\/a><\/p>\n<p>Hardware-wise, there&#8217;s a trigger input on pin 2 (use a zener if you&#8217;re worried about blowing stuff up&#8230;), and the MIDI out is the standard (TX, GND, and 5V through a 220 ohm resistor going to the pins of the MIDI port).<\/p>\n<p>You may want to configure some of the #define statements in the code. STOP_TIMEOUT is the amount of time that needed without triggers needed for the converter to decide to stop. I&#8217;m using 2 seconds.\u00c2\u00a0 Changing DIVIDE_SLICE would be important if your trigger source is something other than 4ppqn, and CODE_OVERHEAD_TIME is used to adjust drift in your deployment &#8211; 10 worked really well for me in my tests tonight, but it could be anything for others.<\/p>\n<p>Once it&#8217;s hooked up and connected to your MIDI source and your trigger source, start sending a series of pulses to pin 2. On the first pulse, MIDI Clock start should get sent, and by the third pulse or so the sync will be &#8220;synced&#8221; &#8211; there will be an offset, but it should remain fairly constant. Now, once the pulses stop, clock will continue to be sent until STOP_TIMEOUT milliseconds have passed.<\/p>\n<p>Next test will be syncing the DR-110 to the very-nearly-finished x0xb0x to see how well that keeps up &#8211; I did all my tests tonight with a Yamaha RY10, with both it and the DR110 just playing a &#8220;four on the floor&#8221; kick pattern.<\/p>\n<p>Questions? Comments? Improvements?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OK, the trigger-to-MIDI clock converter seems relatively happy (though I think the MIDI in on my AN200 isn&#8217;t? That&#8217;s going to require some more tests&#8230;). I hacked on it a bit tonight trying to determine how drifty the generated MIDI clock was relative to the incoming trigger pulses from the&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/www.glacialcommunications.com\/news\/2009\/12\/arduino-trigger-to-midi-converter\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,42,20,16],"tags":[],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-arduino","category-electronics","category-software","category-synthesizers"],"_links":{"self":[{"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":4,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":684,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/posts\/680\/revisions\/684"}],"wp:attachment":[{"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.glacialcommunications.com\/news\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}