{"id":85,"date":"2021-04-16T16:02:31","date_gmt":"2021-04-16T14:02:31","guid":{"rendered":"https:\/\/radix-studio.fr\/blog\/?p=85"},"modified":"2023-04-05T13:10:00","modified_gmt":"2023-04-05T11:10:00","slug":"midirouter-by-example-part2","status":"publish","type":"post","link":"https:\/\/radix-studio.fr\/blog\/2021\/04\/16\/midirouter-by-example-part2\/","title":{"rendered":"MIDIRouter by example &#8211; part2"},"content":{"rendered":"\n<p>This article provides some detailed example and associated configuration file for MIDIRouter (<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/NothNoth\/MIDIRouter\" target=\"_blank\">https:\/\/github.com\/NothNoth\/MIDIRouter<\/a>).<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Pitch Wheel as an Aftertouch wheel<\/h2>\n\n\n\n<p>So your keyboard has a Pitch Wheel but not an aftertouch one? Worse, keyboard still uses channel 7 (and you&rsquo;ve lost the manual) and you want Aftertouch events to be sent on channel 1.<\/p>\n\n\n\n<p>It&rsquo;s pretty easy so setup a simple configuration to convert Pitch Wheel messages into Aftertouch.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"SourceDevice\": \"Korg\",\n    \"DestinationDevice\": \"MOOG\",\n    \"DefaultPassthrough\": false,\n    \"Verbose\": true,\n    \"Rules\": &#91;\n        {\n            \"Name\": \"Pitch Wheel to Aftertouch\",\n            \"Filter\": {\n                \"Name\": \"All Pitch Wheel\",\n                \"MsgType\": \"Pitch Wheel\",\n                \"Channel\": \"7\",\n                \"Settings\": {\n                    \"Pitch\": \"*\"\n                }\n            },\n            \"Transform\": {\n                \"Mode\": \"None\"\n            },\n            \"Generator\": {\n                \"Name\": \"Aftertouch out\",\n                \"MsgType\":\"Aftertouch\",\n                \"Channel\": \"1\",\n                \"Settings\": {\n                    \"Pressure\": \"$\"\n                }\n            }\n        }\n    ]\n}<\/code><\/pre>\n\n\n\n<p>The header section of the figuration file is again qui simple, just set the input MIDI interface and the output one.<\/p>\n\n\n\n<p>We can achieve our use case with just one simple rule.<\/p>\n\n\n\n<p><strong>Filter:<\/strong><\/p>\n\n\n\n<p>On the filter section, we set MsgType to \u00ab\u00a0Pitch Wheel\u00a0\u00bb in order to look for these messages on our input interface. <\/p>\n\n\n\n<p>We use &lsquo;7&rsquo; for midi channel because your Pitch Wheel events are sent on this channel (and you&rsquo;ve lost the manual, remember).<\/p>\n\n\n\n<p>We set the Pitch value to &lsquo;*&rsquo; because we want to process all values.<\/p>\n\n\n\n<p><strong>Transform:<\/strong><\/p>\n\n\n\n<p>Again we won&rsquo;t use the Transform section here, we want to map the complete pitch range (0 to 127) to aftertouch events (0 to 127), so we set it to \u00ab\u00a0None\u00a0\u00bb.<\/p>\n\n\n\n<p><strong>Generator:<\/strong><\/p>\n\n\n\n<p>We want to send Aftertouch events, so we set MsgType to \u00ab\u00a0Aftertouch\u00a0\u00bb.<\/p>\n\n\n\n<p>We want to re-emit the message on the channel 1 instead of the original 7 channel: we set the Channel to &lsquo;1&rsquo;.<\/p>\n\n\n\n<p>Now comes the (almost)-tricky part:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Pitch Wheel have Pitch values<\/li><li>Aftertouch have Pressure values<\/li><\/ul>\n\n\n\n<p>We want to copy the pitch value read from the Pitch Wheel event to the pressure value of the Aftertouch event. We canot use \u00ab\u00a0*\u00a0\u00bb as a Pressure value because Pitch Wheel and Aftertouch are distinct events.<\/p>\n\n\n\n<p>On a Generator configuration, values can be set to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A given hardcoded value (what we did for the MIDI Channel)<\/li><li>&lsquo;*&rsquo;: The original value of same type (what we did on our previous example with Note on events)<\/li><li>&lsquo;$&rsquo;: The extracted value from the captured message<\/li><\/ul>\n\n\n\n<p>What value is extracted from the Pitch Wheel message? The Pitch value!<\/p>\n\n\n\n<p>So by using <em>\u00ab\u00a0Pressure\u00a0\u00bb: \u00ab\u00a0$\u00a0\u00bb<\/em> we just copy the extracted Pitch value to the Pressure value.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>By using a similar technique, you could also use the Pitch Wheel to generate NoteOn events, use Notes to generate Program Change events and so on!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article provides some detailed example and associated configuration file for MIDIRouter (https:\/\/github.com\/NothNoth\/MIDIRouter). Using Pitch Wheel as an Aftertouch wheel So your keyboard has a Pitch Wheel but not an aftertouch one? Worse, keyboard still uses channel 7 (and you&rsquo;ve lost the manual) and you want Aftertouch events to be sent on channel 1. It&rsquo;s &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/radix-studio.fr\/blog\/2021\/04\/16\/midirouter-by-example-part2\/\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;MIDIRouter by example &#8211; part2&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[5],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-electronics","tag-midirouter"],"_links":{"self":[{"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":1,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/posts\/85\/revisions\/86"}],"wp:attachment":[{"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/radix-studio.fr\/blog\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}