Using machine learning in music and especially in drum composition is a very broad topic and I picked out only a few examples of algorithmic approaches that either imitate or innovate human rhythmic drum creation and that help to find suitable drum patterns for played instrumental chords.
Rhythmic knocking and drumming are probably the most original forms of making music. Even our early ancestors could have practiced this art. Random sounds once became rhythmically structured compositions. Despite the musical diversity, most compositions are surprisingly similar when listened to closely: there are certain structural elements that are typical for man-made music all over the world. It is suspected hypothesized that musical rhythms could at least partly have been created by the influence of cognitive and biological distortion processes and thus have shaped cultural development. This and further information about the rhythmic nature can be found here.
Why Machine Learning?
The terminology “Machine Learning” is a very vague description of a set of algorithms that perform regression or classifications based on a known set of data, more specifically on attributes and features that characterize the data. The mathematical theory of these algorithms goes back far more than centuries, the actual algorithms were developed since the 60s and find more and more use in practical applications. A lot of preliminary work and knowledge about the subject must be known if you use methods such as Decision Trees and Support Vector Machines, because they mainly work with the extracted features.
Today, thanks to accelerated technical implementation, Neural Networks in particular can be designed in a complex manner. The interesting thing about this is that, for instance, in image recognition, no features need to be extracted any more, but if there is a sufficient amount of marked data, the features can be learned by the algorithm itself. This is exciting in so far as the human being no longer quantifies the problem by rules but allows it to be interpreted naturally to a certain extent.
Human tempo drift
Computational drum machines or drum software are very accurate. To add a little groove you might set some swing percentage as an input parameter. Some drum machines add some random noise on the onset and offset time and volume. But these methods still do not result in how people actually play the drums. To overcome this issue characteristic and real tempo drifts have been analyzed and used for a system, that is able to learn how to vary drum patterns in a human way – A Drum Machine That Learns to Groove.
Jazz Jamming with MANDI
Researchers at the Faculty of Information Technology in Melbourne developed an algorithm, the Musically Attentive Neural Drum Improviser (MANDI), that generates drum patterns in real-time to accompany improvised performances with human musicians. Performances of this algorithm can be heard at their example folder.
GrooVAE is a subproject of Magenta, that focuses primarily on learning from human grooves and “jam” on rhythms and drum patterns. On their official website they give examples of usage in forms of a web app (try it out !) or for Python programmers the Google Colab Notebook.
Currently I am working on an implementation of the tensorflow models for the inference to create drum patterns on the Raspberry Pi 4. If you want to get some more insight on how I do this and what experience I could take from this project until now, you can leave a comment on this blog post.
See also / sources: