{"id":1639,"date":"2020-04-22T15:45:14","date_gmt":"2020-04-22T14:45:14","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1639"},"modified":"2020-08-22T08:47:00","modified_gmt":"2020-08-22T07:47:00","slug":"tuning-the-pi","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2020\/tuning-the-pi","title":{"rendered":"Tuning the Pi"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 5 of 6 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/lego-ipmidi\" class=\"series-359\" title=\"LEGO ipMIDI\">LEGO ipMIDI<\/a><\/div>\n<p>A few things to prevent having ALSA Xrun&#8217;s and possible reduncing overall latency:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>disabling Bluetooth (edit raspi-config and also disabling related services &#8211; NOTE FROM THE FUTURE: you don&#8217;t want to do this if you later decide to use the RPi with your LEGO BLE hubs)<\/li><li>overclock the RPi (I&#8217;m using a 3B, so 1300 MHz instead of 1200 and enabling force_turbo in raspi-config and replacing the &#8216;ondemand&#8217; scaling_governor by &#8216;performance&#8217; so the CPU always run at full speed) <\/li><li>boot only in console mode (raspi-config)<\/li><li>create a systemd service that starts &#8216;multimidicast&#8217; and &#8216;yoshimi&#8217; and then connects them with &#8216;aconnect&#8217;<\/li><\/ul>\n\n\n\n<p>This last step was tricky&#8230; I had to force a 15 seconds delay before starting &#8216;multimidicast&#8217; because it was complaining that there was no multicast support on the kernel (looks like wi-fi needs a lot of time to settle).<\/p>\n\n\n\n<p>Also had to find a way to load the proper instrument when &#8216;yoshimi&#8217; starts:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yoshimi -a -b 1024 -i -c --state=\/home\/pi\/ipmidi\/harpa-state.state &amp;<\/pre>\n\n\n\n<p>&#8220;harpa-state.state&#8221; is a state file I previously generated inside &#8216;yoshimi&#8217; console, after setting the proper instrument (an harp, ID 107 from bank 110).<\/p>\n\n\n\n<p>So my Raspberry Pi 3B now automatically starts a MIDI synth and plays whatever MIDI commands it receives through multicast.<\/p>\n\n\n\n<p>I can now play with my &#8220;keyboard&#8221; (the pair of EV3 with 8 touch sensors) and also with TouchDAW on my Android phone at the same time. No stucked notes and no noises that might indicate  Xrun&#8217;s. But there is a small background noise that I think is coming from the internal sound card &#8211; for  just a 10 or 11 bit PWM emulating a sound card it&#8217;s very acceptable but I will try a USB sound card I have here to see if it reduces the noise.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 5  of 6 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/lego-ipmidi\" class=\"series-359\" title=\"LEGO ipMIDI\">LEGO ipMIDI<\/a><\/div><p>A few things to prevent having ALSA Xrun&#8217;s and possible reduncing overall latency: disabling Bluetooth (edit raspi-config and also disabling related services &#8211; NOTE FROM THE FUTURE: you don&#8217;t want to do this if you later decide to use the RPi with your LEGO BLE hubs) overclock the RPi (I&#8217;m using a 3B, so 1300 &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2020\/tuning-the-pi\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;Tuning the Pi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[],"series":[359],"class_list":["post-1639","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","series-lego-ipmidi"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-qr","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/comments?post=1639"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1639\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1639"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}