# Algebraic Operations on Melodies

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Rather than generating music completely randomly, this Demonstration starts with a simple melody and applies a set of random operations that transform the music into a very complex-sounding song. It is powered by a versatile musical API that can easily be expanded and used for algorithmic composition.

Contributed by: Justin Lubin (July 2015)

(*Mathematica* Summer Camp 2015)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

"tonality shifting" sets the semitones available to the shifting operation. If "Major" or "Minor" is selected, then the melody will only be shifted up and down on the tonic chord; "Atonal" sets no restrictions on the available semitones.

"maximum recursive depth" cuts off the randomization algorithm at a given depth to ensure that the algorithm does not run forever. A larger depth tends to result in longer songs.

"recursion complexity" represents the probability that the next iteration of the recursive algorithm will actually be executed. A larger probability tends to result in more complex songs.

Mathematically, the structure of music can be represented by different algebraic structures. The operation that creates a sequence forms a monoid over the set of all possible melodies, with note concatenation acting as monoid addition and the note with length zero representing the identity element.

In addition to the sequential monoid, parallel composition (chords) form a group over the set of all possible chords, with the layering of notes acting as group addition and the empty note as the identity. The inverse of each element in this group is its negative waveform.

Lastly, the set of pitch classes (C, C#, D, ...) is an Abelian group isomorphic to .

References

[1] Wikipedia. "Transformational Theory." (Jul 30, 2015) en.wikipedia.org/wiki/Transformational_theory.

[2] Wikipedia. "Pitch Space." (Jul 30, 2015) en.wikipedia.org/wiki/Pitch_space.

[3] Wikipedia. "Pitch Class." (Jul 30, 2015) en.wikipedia.org/wiki/Pitch_class.

## Permanent Citation

"Algebraic Operations on Melodies"

http://demonstrations.wolfram.com/AlgebraicOperationsOnMelodies/

Wolfram Demonstrations Project

Published: July 31 2015