Ever wondered what technology lies behind Alive Drumming’s smart web services? Here’s the gist –
Alive Drumming’s innovative web services have been engineered in the Elixir programming language. The web service supplies Alive Drumming’s fully arranged rhythm tracks constructed from multiple takes of long-form audio of very talented drummers.
Simply put, this service –
- Parses a web request,
- Determines the arrangement structure of the requested track,
- Creates the audio-engineering scripts to splice slices of the long-form audio into the result, and finally,
- Executes these scripts, delivering the resulting audio as the output of the service.
Language Compiler as Web Service
Much of this is the textual lexical analysis and classic compiler design. The track description is a simple LR1 language, and the ejected audio-engineering scripts are optimised with a peep-hole optimisation phase. Step 3 above, “Creating the audio-engineering scripts”, additionally involved parsing textual meta-data relating to the long-form audio’s location of differing drumming intensities, fills, pre- and post-fills, drumming breaks, pushes, count-ins and endings. Each has multiple ‘takes’, and algorithms apply a weighting in pseudo-random selections. Initially, languages strong in textual manipulation were considered with the early algorithms prototyped in GAWK, but it became clear a language suitable for massively scalable web services was needed.
Technology Stack – Phoenix / Elixir / Erlang / Linux / GCP
That lead me to Elixir and Phoenix. Elixir is a purely functional language that is strong in text processing facilities and compiles to the Erlang/OTP virtual machine. Phoenix is a web server framework written in Elixir. Elixir/Erlang includes all the advantages of the Open Telecom Platform (OTP) – designed for the ultra maintainability and reliability expected of telecom platforms, such as supervised tasks and in-service module updates. We hosted this on Linux servers on the Google Cloud Platform (GCP) using a highly scalable cluster of Google Compute VMs and Google Cloud Storage.
Dynamic Programming – A performance boost
The programming solution leverages Dynamic Programming in many places. Dynamic Programming is where a problem is (recursively) decomposed into many sub-problems and where sub-problems may occur that are identical to previous ones. If a sub-problem is duplicated, there is no need to solve it again; use the last result. A cache of results allows the algorithm to always check the cache first before solving the sub-problem. This technique was used on many levels within the solution. Elixir’s data structures proved very accommodating, with simple Elixir maps used as caches. Performance measurements showed an average 60% improvement in CPU utilisation and completion times with the caches deployed.
Some areas that deploy caches are
- At the highest level, the resulting audio file itself is cached,
- The creation of audio slices, parameterised by their type and length requirements,
- The pseudo-random selection of instances of audio from a group of weighted alternatives – here, passed selections are used as input to the algorithm as well
Design Caveat – Google Drive
An early design had the resulting audio track cached on Google Drive, with the web server response being a redirect to the cached file. This solution was appealing because it leveraged the mature, scalable, cost-effective Google Drive. However, it proved problematic with Google Drive quickly applying a governor under relatively small amounts of load. It turned out that Google Drive was not a good fit for this type of service. If all the Drive requests came from the web service, throttling was applied, limiting the usefulness. Additionally, it wasn’t easy to supply Google Drive URLs to clients in a way that would reliably not result in authentication requests. Google Storage was eventually used in place of Google Drive.
Summary – a great technology stack
Elixir proved a perfect fit for this project and an absolute pleasure to work in. The tooling around the language is mature and fit for purpose, the OTP platform is the best solution for reliability and maintainability, and the restriction of a purely functional language proved to be more of a benefit than a limitation. Less really can be more with programming language design. The Google Cloud Platform makes infrastructure commissioning, monitoring and maintenance are much more straightforward than physical hardware. The GCP toolset has matured, and the facilities are extensive. We recommend the Phoenix / Elixir / GCP technology stack for developing and deploying mission-critical, complex web services.
Song Rhythm Tracks
Song Rhythm Tracks are a new type of backing track composed entirely of rhythmic backing (no melody or harmony) arranged to the song’s musical form — it’s “songform“. These tracks are complete performances like one gets from a professional drummer. They have a count-in, introduction section, choruses and characteristic endings, framed by fills showing where sections start and end. Even musical bridges and middle choruses have higher intensity where appropriate to the style. Things are kept simple by doing away with the traditional arranger’s interface. One can select a track in under 30 seconds – under 15 seconds once one gets the hang of it.
The App’s player has tempo adjustment and a facility to sequence the tracks for your gig or jam session. It is for musicians of all abilities. New musicians use the App to accompany songs. They get a sympathetic rhythm, so they learn to keep time, get into the groove and internalise the song’s musical structure – All this while enjoying engaging and inspiring rhythms. Gigging musicians catalogue their backing into setlists and use it to guide performance. With quality rhythmic backing, a setlist facility and a musician’s player, the all-in-one App is so convenient that one uses this rhythmic backing more.
Song Rhythm Tracks are high-quality rhythmic backing convenient to select and play. You are not going to get tired of these backing tracks. You are not going to have to sequence anything. You will find that the player and setlist’s user interface encourages continued use. You will get to appreciate the form of your songs more, and you might include these tracks in your own single and album releases. Don’t be put off by experiences with other mobile drumming Apps. Song Rhythm Tracks are something different.
Whether you are learning a new tune, jamming, gigging or cutting your latest album, this Song Rhythm Tracks provides a solution.
Check out samples of the audio at Alive Drumming’s Samples page
Check out these articles from Alive Drumming that give further insights into the thinking behind the product,
Download the Song Rhythm Tracks App on the Apple App Store
Try Alive Drumming’s sampler apps to sample previously arranged tracks of popular tunes. It is then easy to use the app to adjust these to your practice and performance requirements. All the sampler apps are the same Song Rhythm Tracks but with the included sample tracks.