It’s been quite a little while since my last update (here) however after a bit of revision into my OU notes about Decision Trees & a bit of playing around I have had some success!

Also, I have added support for threaded processes (Async Await is just fantastic) as things were starting to slow down quite a bit however it is easy to end up is a bit of a mess when working with Async and recursion so I had to scale things back a bit however the UI remains separate from the heaving lifting.


On the right is a screen shot of the main form which is used to load Midi files, select which track to process & give limits regards the size of the generated Decision Tree.

The file used in the example Bach Invention #1 which can be found all over the internet in Midi form however the file I chose to use was hosted here.


The Order of events to process the Midi file are as follows:

Re-arrange : This loads the select Midi file into the App & Maps the notes to as many different Banjo fret positions as possible.  The mapped positions can be seen in the bottom right of the form. The option to transpose and add limits to the maximum fret number used to map notes is also taken into account during the arrangement process

Build DT: This generates a decision tree based on the parameters selected for the DT Cost Limit, Num of finished nodes. Initially I started with a basic ID3 approach however due to some fantastic performance challenges, I added the ability to select the ‘scope’ of the DT Algorithm.


Create DT Graph: A while ago MS Research produced library Microsoft Automatic Graph Layout “MSAGL” (GitHub Link here). With the library, I found it rather easy to generate a visualisation of Decision Trees + it’s fast! On the right  is an zoomed in extract of the DT generated for the Bach invention.  The complete DT tree can for the Invention can be found here.  (Key : Dimond shape is the first note in the track and the red boxes indicate where the DT process has chosen to not drill down to the children of the node due to the cost being higher than the other node options.)



Create Arrangements: Arrangements are created by traversing the tree. For each completed walk of the tree to the last note in the sequence, an arrangement is created. During the traversal, the total costs are calculated to provide some level of comparison between the arrangement options. Arrangements generated from the invention on the default DT settings result in the options on the left.


Create Tab : So an example of the final output is the tab show below. The Tab is generated using the AlphaTab library (Site link here). The library is really good & I have had the chance to contribute with a code fix (Open source is great!).



And that is it! the first fully working version of the Melodic Banjo Arrangement tool.  It’s been a fun project with quite bit of background reading & some very useful libraries which I will no doubt find some use for in future.

Although there are quite a few tweeks & fixes I want to apply the process does work so feel free to fork the project and have a look for yourself (Github project link here)

Melodic Banjo Arrangement : It’s Alive!

Leave a Reply

Your email address will not be published. Required fields are marked *

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10447 bytes) in D:\home\site\wwwroot\wp-content\plugins\crayon-syntax-highlighter\crayon_wp.class.php on line 857