{"id":1412,"date":"2021-06-04T23:05:27","date_gmt":"2021-06-04T22:05:27","guid":{"rendered":"https:\/\/matthewolden.co.uk\/?p=1412"},"modified":"2021-06-04T23:05:27","modified_gmt":"2021-06-04T22:05:27","slug":"midi-in-and-midi-out","status":"publish","type":"post","link":"https:\/\/matthewolden.co.uk\/?p=1412","title":{"rendered":"midi in and midi out"},"content":{"rendered":"<p>heres a pd patch that&#8217;ll help you work out automatic midi assignments<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/midiinout_withalsa.pd_.zip\">midiinout_withalsa.pd<\/a><\/p>\n<p>so we don&#8217;t have to manually connect all the time we can write some code that directly connects our devices with their &#8220;machine names&#8221;.<\/p>\n<p>first off makes sure your using ALSA-MIDI. Then in midi settings tell it how many ports you have (in my example I have 3 ports in and 3 ports out, two midi interfaces, one with\u00a01 output and 1 input, and my trusty midisport with 2 inputs and 2 outputs)<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitledkkk.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1418\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitledkkk-744x1024.jpg\" alt=\"Untitledkkk\" width=\"660\" height=\"908\" \/><\/a><\/p>\n<p>in a terminal window type<\/p>\n<p>aconnect -i<\/p>\n<p>aconnect -o<\/p>\n<p>aconnect -l<\/p>\n<p>this will list all the midi ports (both in and out) on the raspberry pi. In pd i use the shell object to send terminal messages.for instance<\/p>\n<p>sudo aconnect 128:3 24:0\u00a0 \u00a0 connects the midi out of pd to the output of one of my\u00a0midi interfaces (the CH345)<\/p>\n<p>sudo aconnect 24:0 128:0\u00a0 \u00a0 connects the\u00a0 the midi in of pd to the midi input of one of my midi devices\u00a0(the CH345)<\/p>\n<p>if you open the example patch you&#8217;ll see the first thing it does is send these aconnect messages to join all 3 midi ins and all 3 midi outs<\/p>\n<p>All these numbers might seem confusing but if you have a look in the terminal window you can see what ever codes are used to identify the different devices. just plug your device into the pi and aconnet -l<\/p>\n<p>double click on the picture below and see what i mean.it&#8217;s all laid bare in the terminal window.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitledkkkk1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1419\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitledkkkk1-1024x605.jpg\" alt=\"Untitledkkkk\" width=\"702\" height=\"415\" \/><\/a><\/p>\n<p>alternatively a standard midi connect interface\u00a0 is available, the Aconnectgui.\u00a0 This won&#8217;t remember its settings if you shut the machine down or change midi devices.<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/dfsf.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1420\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/dfsf-529x1024.jpg\" alt=\"dfsf\" width=\"529\" height=\"1024\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>heres a pd patch that&#8217;ll help you work out automatic midi assignments midiinout_withalsa.pd so we don&#8217;t have to manually connect all the time we can write some code that directly connects our devices with their &#8220;machine names&#8221;. first off makes sure your using ALSA-MIDI. Then in midi settings tell it &#8230;<\/p>\n","protected":false},"author":2,"featured_media":1413,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1412","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pd-on-a-pi","column","fourcol","has-thumbnail"],"_links":{"self":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1412"}],"version-history":[{"count":0,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1412\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/media\/1413"}],"wp:attachment":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}