Inspiration

Anyone who has published content on the internet knows how important copyright is to protecting your work. But to many small-scale content creators, royalties and the costs of licensing professionally-produced music present a significant barrier to entry, and existing royalty-free music may not suit their needs. This in mind, our team of programmusicians attempted to create a means to compose music procedurally. Mechanical Mozart is the result.

What it does

Mechanical Mozart includes an algorithm to create chord progressions of a given length, along with melodies which accompany them along the lines of functional harmony. Users can generate and save music audio without musical expertise or export MIDI files to use the compositions with their DAW and VSTs of choice should more control be desired.

How we built it

Using our knowledge of music theory, we wrote an algorithm which takes the previous chord and describes the possible next chord options. To improve the diversity in progressions generated, we associate the probability of given chord appearing with a “need” value for that chord. As a chord is used, its “need” decreases, making it less likely to be chosen. Over time, this value naturally replenishes. Next, we tag on appropriate cadences to end our piece nicely. From these chords, we generate a melody. This part of the composition relies on an algorithm designed to find a note in the current chord that is closest to the last note in the previous chord. We then randomly select three other notes from the current chord to complete the measure. Finally, instruments are assigned randomly to the melody and chords. To add to the instruments included in the jMusic library, we also hacked an additive synthesizer, allowing new synth sounds to be generated using randomized overtones and effects, but as the bulk of our time was dedicated to core functionalities, in the end this instrument was not included in Mechanical Mozart.

Challenges we ran into

GitHub broke Java. We don’t why, but after pushing to the Git repository, we were unable to execute our code. After two hours of fumbling, we decided to abandon GitHub and use a single computer, with others contributing small code segments via Google Docs. The greatest challenge, however, was developing the recursive algorithm which was intended to ensure that our progressions always return to the tonic chord. Ultimately, due to time constraints, we were unable to fully integrate this into our product.

Accomplishments that we're proud of

The compositions of Mechanical Mozart sound nice, and in some cases were actually reminiscent of the human Mozart’s work. After a rather entertaining period where it produced music suitable for horror film or game scores, this was a pleasing result. Generally, we were proud that, in the limited timeframe, we managed to assemble something which works essentially as we intended, with clear avenues for expansion and improvement.

What we learned

The most important lesson we learned from this project was that serendipitous mistakes can contribute equally to success as careful planning. For example, we discovered by accident, after clicking “run” twice, that the resulting music, though unmastered, demonstrates great potential and interest. We also learned much about managing sound files and sound synthesis within Java.

What's next for Mechanical Mozart

In Mechanical Mozart’s future we look forward to seeing improvements to the randomization process. Rather than using completely random numbers, analysis of fractals and chaotic systems can be used to produce more stable patterns. In addition, development of new algorithms based on different parameters could add a extra layer of customization to the user’s royalty free grand spree. This would all come under a clean and colorful GUI. Perhaps this technique of music generation could be adapted to fit longer, structured compositions, and grow to include modulation and variations upon a theme. To make the music directly generated by Mechanical Mozart more usable, we would attempt to add automated mastering functionality, similar to the cloud-based service LANDR. We believe that a descendant of Mechanical Mozart could be the next big thing in “stock” sound libraries across all platforms.

Built With

Share this project:
×

Updates