Jean-Michel Jarre is a great composer, known for beautiful instrumentals
His surname resembles Java class package format, so it only makes sense to use Markov chain to generate records that resemble his music in Java
import org.jfugue.pattern.Pattern;
The simplest way of transcribing notes is from a *.mid
file
Since we’re dealing with MIDI input, playing and saving generated notes, JFugue, Music Programming for Java, is used here
Jean-Michel’s Oxygène (Part IV) has by far the most recognizable theme, and is publicly available in mentioned form
Transcribed into a note pattern, it’s 46 element array is used for ML train
Andrey Markov
Predicting items in a chain is based on a simple principle: probability of each event depends solely on the previous ones
In contrary to most machine learning algorithms – Markov chain doesn’t require copious amounts of input, hence permutations from note pattern are sufficient:
Regained pattern is split into words slice and a field map of
String: ArrayList<String>
is populated with each word:
- if previous word has been joined before – current one is added to it’s array
- otherwise – a key (preceding word) is created with mapping to current one
There is no subsequent for the last word, of course, so the key with longest value array is added as it’s value
A random note from theme is selected as the initial link and the ensuant ones are chained based on the probability of the last one, up to the desired length
E.g:
Different…
src: Flickr
Code is available to dissect alongside a few generated analogues to the famous theme: