Kris Shaffer

music theory & cognition

 

Software for music analysis

Profiler

Profiler is a set of Perl scripts for analyzing sequences of chords (in isolation or in comparison with other chord sequences) in any tonal or non-tonal triadic pieces.  It is distributed under the GNU General Public License, version 3.

Generally, Profiler will analyze a sequence of chordal roots and generate a chord-root probability profile, a root-progression probability profile, and tables of correlation coefficients between those profiles, though there are other functions listed below. Profiler was developed as part of my dissertation research on harmonic syntax in György Ligeti's triadic music.

Download the current version here:  Profiler - version 0.1 (June 2010)

Using Profiler

Profiler is a collection of 15 scripts, but there are two main scripts:  profiler.pl and correlate.plprofiler.pl will take a sequence of chords in a CSV file (or multiple CSV files at once) and generate 1) a CSV file containing the chord-progression sequence (i.e., the intervals between each chord root), 2) a CSV file containing the zeroth-order probabilities for all 12 chord root pitch classes, and 3) a CSV file containing the zeroth-order probabilities for all 12 root-to-root intervals.  Profiler comes with empty folders for storing and organizing these files, but if those folders are absent, it will create them for you.  correlate.pl will take all the chord-root profiles and calculate Pearson and Spearman (rank) correlation coefficients between all profile pairs, and will then do the same for the root-progression profiles.

Due to the nature of the analysis for which I developed profiler, all chord-root information uses the integers 0-11 to refer to the twelve pitch classes C-B.  All root-progression information, however, is measured in perfect fifths (0 = unison, 1 = perfect fifth, 2 = two fifths or a whole tone, 3 = three fifths or a major sixth, etc.).  This may seem counter-intuitive . . . until you look at the profiles generated by tonal and pre-tonal works!

All scripts (except for correlate.pl) are run by navigating to the proper folder and entering the following terminal command:

  1. ./scriptName.pl FolderName/filename.csv

correlate.pl automatically takes all files in the relevant folder, so you can simply enter:

  1. ./correlate.pl

Additionally, Profiler includes the following scripts:

  1. chordsToProfile.pl — takes a CSV file containing a sequence of chords and produces a CSV file containing the chord-root probability profile (component of profiler.pl).

  2. chordsToProgs.pl — takes a CSV file containing a sequence of chords and produces a CSV file containing the corresponding sequence of root-to-root intervals (component of profiler.pl).

  3. progsToProfile.pl — takes a CSV file containing a sequence of root-progressions and produces a CSV file containing the root-progression probability profile (component of profiler.pl).

  4. profilesToSpreadsheet-roots.pl — takes the chord-root probability profiles of the invoked files and compiles a single CSV file containing all profiles, useful for creating multiple graphs quickly (component of profiler.pl).

  5. profilesToSpreadsheet-progressions.pl — takes the root-progression probability profiles of the invoked files and compiles a single CSV file containing all profiles, useful for creating multiple graphs quickly (component of profiler.pl).

  6. pearsonCorrelations-roots.pl — takes the chord-root probability profiles of the invoked files and generates a CSV file containing the Pearson correlation coefficient between every pair of probability profiles (component of correlate.pl).

  7. pearsonCorrelations-progressions.pl — takes the root-progression probability profiles of the invoked files and generates a CSV file containing the Pearson correlation coefficient between every pair of probability profiles (component of correlate.pl).

  8. SpearmanCorrelations-roots.pl — takes the chord-root probability profiles of the invoked files and generates a CSV file containing the Spearman (rank) correlation coefficient between every pair of probability profiles (component of correlate.pl).

  9. SpearmanCorrelations-progressions.pl — takes the root-progression probability profiles of the invoked files and generates a CSV file containing the Spearman (rank) correlation coefficient between every pair of probability profiles (component of correlate.pl).

  10. profileToRandomSequence.pl — takes a chord-root probability profile and generates a random sequence of 10,000 chords with the same relative chord-root distribution.

  11. transpose.pl — takes a chord-root probability profile and generates all twelve transpositions of that profile, useful for finding which transposition is best for comparison with some other profile.

  12. rawToProb-roots.pl — takes a raw tally of chords built on each of the 12 pitch-class roots and generates a probability profile (sum 1).

  13. rawToProb-progressions.pl — takes a raw tally of each of the 12 root intervals found in a sequence of root progressions and generates a probability profile (sum 1).

Notes on file formatting

The file format for the initial chord sequence file is very simple.  The Profiler scripts will take any CSV file with UNIX-friendly line breaks (you may need to do a quick conversion in a text editor like Text Wrangler if you created the CSV file with a standard spreadsheet application), and it will look only at the data on each line which precedes the first comma.  That data should be one of the following: 

  1. 0 1 2 3 4 5 6 7 8 9 10 11 q x

Any other numbers or characters will return an error.  Currently, Profiler will not process q and x, but they are there for future processing of things like single tones, dyads, or dissonant sonorities.  Any integer 0-11 will be counted toward the chord-root probability profile, but only progressions between two integers will be counted in the root-progression sequence and profile.  In the future, I hope to have additional scripts which will process information after the first comma (such as chord quality), but for now Profiler ignores it.

Profiler has been very useful for me in my current analytical work, and I offer it free under the GPL for any who think it may be useful for them.  Under the GPL, you are free to redistribute it and alter it, as long as you don’t change the licensing or withhold those freedoms for others in your altered version.  If you find Profiler useful, or you find ways to improve it for your research, I’d love to hear about it.  Please send me an email!