{"id":2311,"date":"2018-03-18T22:41:29","date_gmt":"2018-03-18T22:41:29","guid":{"rendered":"http:\/\/www.trivedigaurav.com\/blog\/?p=2311"},"modified":"2020-09-27T18:01:27","modified_gmt":"2020-09-27T18:01:27","slug":"machines-learn-to-play-tabla-part-2","status":"publish","type":"post","link":"https:\/\/www.trivedigaurav.com\/blog\/machines-learn-to-play-tabla-part-2\/","title":{"rendered":"Machines learn to play Tabla, Part &#8211; 2"},"content":{"rendered":"<blockquote><p>This is a followup on my earlier post on <a href=\"http:\/\/www.trivedigaurav.com\/blog\/machines-learn-to-play-tabla\/\">Machines Learn to play Tabla<\/a>. You may wish it check it out first reading this one&#8230;<\/p><\/blockquote>\n<p>Three years ago, I published a <a href=\"https:\/\/www.trivedigaurav.com\/blog\/machines-learn-to-play-tabla\/\">post<\/a> on using recurrent neural networks to generate tabla rhythms. Sampling music from machine learned models was not in vogue then. My post received a lot of attention on the web and became very popular. The project had been a proof-of-concept and I have wanted build on it for a long time now.<\/p>\n<p>This weekend, I worked on making it more interactive and I am excited to share these updates with you. Previously, I was using a <a href=\"http:\/\/taalmala.com\">proprietary software<\/a> to convert tabla notation to sound. That made it hard to experiment with sampled rhythms and I could <a href=\"https:\/\/soundcloud.com\/trivedigaurav\/sets\/machine-learned\">share only a handful sounds<\/a>. Taking inspiration from our friends at Vishwamohini, I am now able to convert <em>bols<\/em> into rhythm on the fly using <a href=\"https:\/\/github.com\/mudcube\/MIDI.js\">MIDI.js<\/a>.<\/p>\n<p>Let me show off the new javascript synthesizer using a popular Delhi <em>kaida<\/em>. Hit the &#8216;play&#8217; button to listen:<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/trivedigaurav.com\/exp\/tabla-js-master\/delhi-kaida.html\" width=\"100%\" height=\"200px\"><\/iframe><\/p>\n<p>Now that you&#8217;ve heard the computer play, here&#8217;s an example of it being played by a tabla maestro:<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/k9N8kwVP_V4?start=14\" allowfullscreen=\"allowfullscreen\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<p dir=\"ltr\" lang=\"en\">Of course, the synthesized outcome is not much of a comparison to the performance by the maestro, but it is not too bad either&#8230;<\/p>\n<p dir=\"ltr\" lang=\"en\">Now to the more exciting part- Since our browsers have learned to play the tabla, we can throw in the <em>char-rnn<\/em> model that I built in the earlier post.&nbsp; To do this, I used the <a href=\"https:\/\/github.com\/karpathy\/recurrentjs\">RecurrentJS library<\/a> and combined it with my javascript tabla player:<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/trivedigaurav.com\/exp\/tabla-js-master\/generate.html\" width=\"100%\" height=\"220px\"><span style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" data-mce-type=\"bookmark\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n<p dir=\"ltr\" lang=\"en\">Feel free to play around with tempo and maximum character-limit for sampling. When you click on &#8216;generate&#8217;,&nbsp; it will play a new rhythm every time. Hope you&#8217;ll enjoy playing with it as much as I did!<\/p>\n<p dir=\"ltr\" lang=\"en\">The player has a few kinks at this point I am working towards fixing them. You too can contribute to my repository on <a href=\"http:\/\/github.com\/trivedigaurav\/tabla-js\">GitHub<\/a>.<\/p>\n<p>There are two areas that need major work:<\/p>\n<p><em>Data: <\/em>The models that I trained for my earlier post was done using a small amount of training data. I have been on a lookout for better dataset since then. I wrote a few emails, but without much success till now. I am interested in knowing about more datasets I could train my models on.<\/p>\n<p><em>Modeling: <\/em>Our model did a very good job of understanding the structure of <a href=\"http:\/\/www.taalmala.com\/help.shtml\">TaalMala notations<\/a>. Although <a href=\"https:\/\/github.com\/karpathy\/char-rnn\">character level recurrent neural networks<\/a> work well, it is still based on very shallow understanding of the rhythmic structures. I have not come across any good approaches for generating true rhythms yet:<\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p dir=\"ltr\" lang=\"en\">Do any ML poetry generators do rhyme or meter yet? Seems like a hard feature to model\/train (compared to a grammar or constraint approach, etc)<\/p>\n<p>Im curious if anyone got it yet<\/p>\n<p>\u2014 Kate Compton (@GalaxyKate) <a href=\"https:\/\/twitter.com\/GalaxyKate\/status\/975040582044196864?ref_src=twsrc%5Etfw\">March 17, 2018<\/a><\/p><\/blockquote>\n<p>I think more data samples covering a range of rhythmic structures would only partially address this problem. Simple rule based approaches seem to outperform machine learned models with very little effort. <a href=\"http:\/\/vishwamohini.com\/music\/variation-generator.php\">Vishwamohini.com<\/a> has some very good rule-based variation generators that you could check out.&nbsp; They sound better than the ones created by our AI. After all the word for compositions- <em>bandish, <\/em>literally derived from &#8216;rules&#8217; in Hindi. But on the other hand, there are only so many handcrafted rules that you can come up with which may lead to generating repetitive sounds.<\/p>\n<p dir=\"ltr\" lang=\"en\"><a href=\"http:\/\/www.trivedigaurav.com\/blog\/contact\/\">Contact me<\/a> if you have some ideas and if you&#8217;d like to help out! Hope that I am able to post an update on this sooner than three years this time \ud83d\ude00<\/p>\n<p><script async=\"\" src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a followup on my earlier post on Machines Learn to play Tabla. You may wish it check it out first reading this one&#8230; Three years ago, I published a post on using recurrent neural networks to generate tabla rhythms. Sampling music from machine learned models was not in vogue then. My post received &hellip; <a href=\"https:\/\/www.trivedigaurav.com\/blog\/machines-learn-to-play-tabla-part-2\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Machines learn to play Tabla, Part &#8211; 2<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21,13,7,47,22,24],"tags":[],"class_list":["post-2311","post","type-post","status-publish","format-standard","hentry","category-fun","category-machine-learning","category-man-vs-machine","category-natural-language-processing","category-projects","category-updates"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p46eol-Bh","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/2311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/comments?post=2311"}],"version-history":[{"count":49,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/2311\/revisions"}],"predecessor-version":[{"id":2941,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/2311\/revisions\/2941"}],"wp:attachment":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/media?parent=2311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/categories?post=2311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/tags?post=2311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}