Music Scrambling

This MATLAB function reads in a MIDI file and generates alternative versions with the pitch and/or timing scrambled. This was originally used in functional imaging studies investigating brain regions sensitive to music structure.

The idea is to create a new sound signal with roughly the same component elements, but with the musical structure destroyed. This is accomplished in two ways: by randomizing the pitch (adding a random amount to the pitch of each note, and then randomly reassigning pitches to notes), and by randomizing the onsets and durations (by adding a random amount to each note onset time, and then randomly reassigning note durations).

Example Stimuli:

Original Unscrambled Music:
Pitch Scrambled:
Rhythm Scrambled:
Pitch and Rhythm Scrambled:

Pitch Histograms Before and After Scrambling:

It is apparent in the pitch and chroma histograms for this example that the tonal structure of the original (evident in the non-uniform chroma distribution) is destroyed by the scrambling. The regular beat and metrical structure of the original is similarly disrupted by the rhythm scrambling.

pitch and chroma histograms



Back