I want to generate musical compositions via machine learning and I’d like to know what statistical techniques could work. There are existing approaches that generate music of general interest, but this is more personal, generating music in my own style as a composer, and my primary goal is learning about machine learning rather than generating the next Pulitzer-prize-winning piece.

My first goal is to use statistics to categorize short musical passages as “good” or “bad,” and possibly other categories like naming a style or marking a passage “incomplete.” I can generate a few hundred training examples semi-manually. I might be able to increase the training example set once something is partially working by generating more examples statistically and manually categorizing them after a quick listen.

Music is composed of notes. For my purpose I’ll consider a note as an event with a time of onset (a float, number of seconds), a stop time (float), and a pitch (an integer in the range 20 to 90 or so, matching existing MIDI pitch numbers). We could graph a musical passage as something like this: Graph of short passage

How should we analayze a passage?

We could consider this to be a visual image and do image processing on it, or run it through a neural network.

However, I think it’s more promising to analyze a passage by identifying musical features. For example, a group of notes may match an existing type of chord. In the following I’ve circled some notes that together would be that chord. Some other aspects of the passage, such as the average pitch or duration of the group, while visible in the image, might not be as salient.

enter image description here

I think the training set would be like a spreadsheet in which the values in a row represent the features in each example. There might be 1000 or more columns (features) of potential relevance, although the good and bad examples would probably cluster in regions defined by a much fewer number of features (the relevant features might be different for each cluster). The trick is finding out which features are relevant.

enter image description here

The values in the cells would be Boolean or integral over fairly small ranges.

As far as techniques, I’ve heard of trees, random forests, logistic regression and similar techniques, but I don’t know which one would be applicable to this problem. Note that I’m doing this project mainly to learn machine learning by way of having an actual application that interests me, so it may not be as important how successful this is, but rather how much I can learn from attempting it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.