{"id":1657,"date":"2020-08-22T08:43:36","date_gmt":"2020-08-22T07:43:36","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1657"},"modified":"2020-08-22T08:43:38","modified_gmt":"2020-08-22T07:43:38","slug":"a-few-last-notes","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2020\/a-few-last-notes","title":{"rendered":"A few last notes"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 6 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>After some weeks working fine I decided to integrate this ipMIDI thing with my wife&#8217;s new LEGO Grand Piano. Doing this I realized a few things were missing in these posts:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The audio card<\/h2>\n\n\n\n<p>I indeed changed from the internal audio to a cheap USB audio card. The background noise has gone, as expected.<\/p>\n\n\n\n<p>The sound card is seen as &#8220;hw:CARD=Set,DEV=0&#8221; so I needed to add a parameter to the &#8216;yoshimi &#8216;command (you can find the available audio devices with the ALSA command &#8220;aplay -L&#8221;&#8230; sometimes the same card will show more than one because the chipset may support several audio modes)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The startup script<\/h2>\n\n\n\n<p>the script first starts &#8216;multimidicast&#8217;, then it starts &#8216;yoshimi&#8217; and sets the MIDI connections between the two:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!\/usr\/bin\/env bash\nsudo sh -c \"echo performance > \/sys\/devices\/system\/cpu\/cpu0\/cpufreq\/scaling_governor\"\nsleep 15\n\/home\/pi\/ipmidi\/multimidicast-1.4\/multimidicast &amp;\nsleep 3\nyoshimi -a -b 1024 -i --state=\/home\/pi\/ipmidi\/harpa-state.state &amp;\nyoshimi -a -i -c --state=\/home\/pi\/ipmidi\/harpa-state.state --alsa-audio=hw:CARD=Set,DEV=0 &amp;\nsleep 5\naconnect 128:0 129:0\naconnect 128:1 129:0\naconnect 128:2 129:0\naconnect 128:3 129:0<\/pre>\n\n\n\n<p>(before all that it all changes the kernel governor from the default &#8216;ondemand&#8217; to &#8216;scaling&#8217;)<\/p>\n\n\n\n<p>In order to run this script automatically when the Raspberry Pi turns out I created a systemd service (used <a href=\"https:\/\/www.raspberrypi.org\/documentation\/linux\/usage\/systemd.md\">this guide<\/a>):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\nDescription=Yoshimi\nAfter=network.target\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=\/home\/pi\/ipmidi\/startup.sh\nWorkingDirectory=\/home\/pi\/ipmidi\nStandardOutput=inherit\nStandardError=inherit\nRestart=no\nUser=pi\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Nothing else<\/h2>\n\n\n\n<p>exactly, nothing else is needed. When trying to use a python script on the RPi to control the Grand Piano I realized that I had disabled bluetooth to reduce latency. But instead of reverting it I installed everything again on a larger microSD card because the one I was using had not enough space for updates. Doing that I made no performance tuning at all and the the performance is still quite good using my Android phone in hotspot mode.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 6  of 6 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/lego-ipmidi\" class=\"series-359\" title=\"LEGO ipMIDI\">LEGO ipMIDI<\/a><\/div><p>After some weeks working fine I decided to integrate this ipMIDI thing with my wife&#8217;s new LEGO Grand Piano. Doing this I realized a few things were missing in these posts: The audio card I indeed changed from the internal audio to a cheap USB audio card. The background noise has gone, as expected. The &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2020\/a-few-last-notes\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;A few last notes&#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-1657","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-qJ","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1657","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=1657"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1657\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1657"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}