One of the creative approaches to synthesizing music is to start with a short melodic motif and then apply various transformations on it. The motif is usually (but not necessarily) of 1 bar duration.

What are some possible transformations? This depends on one’s creativity, but here is a simple list:

1) Identity transformation:

Do nothing on the input, just return it as it is.

2) Augmentation:

Increase the duration of each note by a factor two (or four, etc.), so it plays slower. The pitches are not disturbed.

3) Diminution:

Reduce the duration of each note by a factor two (or four, etc.), so it plays faster. The pitches are not disturbed.

4) Replace a pitch with another:

Replace one of the pitches with another pitch, randomly.

5) Swap two pitches:

Swap randomly chosen two pitches.

5) Replace a pitch with rest:

Silence a pitch, chosen at random. The total duration is not altered.

6) Sort the pitches in ascending order:

Reorder the pitches in the motif so that they are in ascending order of pitch values.

7) Sort the pitches in descending order:

Reorder the pitches in the motif so that they are in descending order of pitch values.

8) Reverse the pitches:

Reverse the order of pitches in the motif.

9) Shuffle the pitches:

Shuffle the pitches randomly.

10) Shuffle the durations:

Keeping the order of pitches the same, randomly shuffle the lengths.

The above are just a few possibilities. I am sure you can think of a few more.

How to apply the transformations?

When we apply a sequence of transformations starting from the given motif, there are at least two ways to go about it. One is to apply the transformations sequentially on the same input that we started with. The other is to apply the first transformation on the given input, and then onwards, apply each transformation on the result of the previous transformation. Some transformations can yield interesting results when we use the second approach; for example, consider transformation (5). This will result in increasing number of rests as the transformations progress, because in each transformation we replace one pitch by rest. In general, we can choose the strategy that suits us best in a given context.

For today’s post, I have implemented the different transformations as well as the two transformation strategies explained above. I have also defined a sample score using these ideas in Opusmodus.

Motifs and transformations