{"id":3369,"date":"2019-12-06T17:12:00","date_gmt":"2019-12-06T17:12:00","guid":{"rendered":"https:\/\/azoora.com\/blog\/?p=3369"},"modified":"2019-11-29T01:22:25","modified_gmt":"2019-11-29T01:22:25","slug":"interactive-musical-instruments-with-javascript-and-web-audio-api","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/javascript\/interactive-musical-instruments-with-javascript-and-web-audio-api\/","title":{"rendered":"Interactive Musical Instruments with Javascript and Web Audio API"},"content":{"rendered":"\n<p>Experimental ideas for playful musical interactions powered by <strong>MIDI.js<\/strong> and the <strong>Web Audio API<\/strong>. Play instruments or make sounds by interacting with content.<\/p>\n\n\n\n<p>The schematically presented instruments can all be played by clicking on the interactive parts, i.e. the keys or strings. This will make the respective sound for that note. In addition, holding the mouse pressed and moving it will allow you to play sound sequences. The guitar will play back chords if you do this movement. Depending on the position, different chords will be given off. Try strumming around.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"3373\" data-permalink=\"https:\/\/azoora.com\/blog\/javascript\/interactive-musical-instruments-with-javascript-and-web-audio-api\/attachment\/musical-interactions-guitar\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar.png\" data-orig-size=\"890,554\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Musical-Interactions-Guitar\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar-300x187.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar.png\" loading=\"lazy\" width=\"890\" height=\"554\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar.png\" alt=\"\" class=\"wp-image-3373\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar.png 890w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar-300x187.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Guitar-768x478.png 768w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><\/figure>\n\n\n\n<p>The section with the microphone (\u201cVoice\u201d section) will play a recorded sound. It will get louder if you move closer to the center.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"3372\" data-permalink=\"https:\/\/azoora.com\/blog\/javascript\/interactive-musical-instruments-with-javascript-and-web-audio-api\/attachment\/musical-interactions-mic\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic.jpg\" data-orig-size=\"890,577\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Musical-Interactions-Mic\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic-300x194.jpg\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic.jpg\" loading=\"lazy\" width=\"890\" height=\"577\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic.jpg\" alt=\"\" class=\"wp-image-3372\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic.jpg 890w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic-300x194.jpg 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions-Mic-768x498.jpg 768w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><\/figure>\n\n\n\n<p>The small instruments will all make sounds on click and whenever you click, a different sound or chord will be played. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"3371\" data-permalink=\"https:\/\/azoora.com\/blog\/javascript\/interactive-musical-instruments-with-javascript-and-web-audio-api\/attachment\/musical-instruments-01\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01.png\" data-orig-size=\"890,506\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Musical-Instruments-01\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01-300x171.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01.png\" loading=\"lazy\" width=\"890\" height=\"506\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01.png\" alt=\"\" class=\"wp-image-3371\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01.png 890w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01-300x171.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Instruments-01-768x437.png 768w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><\/figure>\n\n\n\n<p>Just have a try on all instrument sections and make some noise &#x1f642;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><strong>Demo<\/strong>: <a href=\"http:\/\/tympanus.net\/Development\/MusicalInteractions\/\">Link<\/a><\/p><p><strong>Download<\/strong>: <a href=\"https:\/\/github.com\/codrops\/MusicalInteractions\/archive\/master.zip\">GitHub<\/a><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Experimental ideas for playful musical interactions powered by MIDI.js and the Web Audio API. Play instruments or make sounds by interacting with content. The schematically presented instruments can all be played by clicking on the interactive parts, i.e. the keys or strings. This will make the respective sound for that note. In addition, holding the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3374,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[191,12],"tags":[192,116,87],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/11\/Musical-Interactions.jpg","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-Sl","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3369"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=3369"}],"version-history":[{"count":1,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3369\/revisions"}],"predecessor-version":[{"id":3375,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/3369\/revisions\/3375"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/3374"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=3369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=3369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=3369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}