digital harmony


I’ve built the harmonypartition system to generate harmonic sequences with just a few small numbers. Here is a simple one, built from simple piles of sine waves. Later they can of course expand to MIDI and DAW systems.

harmony as a sequence

So to begin: the following sequence:

base_seq = [4,3,2,1]

…can generate this chord sequence:

vi-ii-V-1 in C Major

This is not such a big deal, but it is already interesting that a harmonic parametrization can be rendered as simply as a melodic contour.

What is interesting is that the system underneath is much more than usually flexible. Change one parameter:

p = 5

… and you get this:

vi-ii-V-1 in C minor

This means, for example, that you could change the entire harmonic atmosphere of music (e.g in a game or film) according to easily structured parameters.

Intuitive relationships among these parameters would allow harmonic atmospheres to change meaningfully based on the motion of a joystick, a changing of levels, or other measurable conditions.

minimal encoding

And the encoding is very small, but non-trivial: it gives not only the notes but the function of each chord, which allows for improvisation. Here, for example is the encoding for the chords of ‘Blue in Green’:


…which sounds like this (with its bass line calculated from the encoding):

blue in green – analyzed chord cycle

…and like this with a field of (mathematically extrapolated, and slightly hysterical) notes above it:

I also use these small generated files (looped, and longer) to help violin students play over chords. Also, the encoding of a chord is small enough (32 bits) that the sharing of harmonic sequences over software (and IoT) could be rigorous on the one hand (for systems), and flexible (for people) on the other.

flexible decompression

What’s curious is that the system employs a type of compression which can be flexibly decompressed – delivering a world of sensible possibilities rather than a single unambiguous solution. This ambiguity derives from the fundamental ternary treatment of the byte.

digital harmony

audio => harmony

harmonypartition can harmonically analyze audio files by dynamically seeking and organizing tonal continuities.

In a great many musical cases, these continuities take the form of familiar keys and chords.

example: vi-ii-V-I

Here, for example, is a vi-ii-V-I progression in C major, generated from fourier analysis of a .wav file:

C Major vi-ii-V-I in sine waves, derived from synthesized audio

Here is the same progression, analyzed from my own lightly out-of-tune piano, with a different voicing:

C Major vi-ii-V-I on piano, live audio

Although the underpinnings and overtones (shown below and atop the central graphs) are shaken by the realities of live sound, the central analysis holds equally.

generating graphs

We can generate graphs with the following python code from the harmonypartition modules:

audio_kpdve_graph.graph_audio_file("C_6251_live.wav", chroma_threshold=0.3)

A firm, unchanging mathematical system undergirds the analysis, working within the idea of number, group, and ternary rather than with statistical operations. In the course of this method, the harmonic system functions as a hybrid, highly efficient form of neural network, using a miniature backpropagation to find meaningful (and maximally lazy) tonal centers.

It is possible in this manner to analyze any audio file for music-harmonic content, exposing large-scale structures in the musical works. Examples of this type of analysis can be seen in the “Audio and Insights” pages at the Charlottesville Chamber Music Festival.

Beethoven: Sonata No. 1 for Violin and Piano in D Major, Op. 12, No. 1, Mvt. 3 with Jennifer Frautschi, violin, and Max Levinson, piano

Schubert: Fantasie for Violin and Piano, D934, excerpts with James Ehnes, violin, and Inon Barnatan, piano

Beethoven: Sonata No. 10 for Violin and Piano in G Major, Op. 96, mvt. 4, with Timothy Summers, violin, and Benjamin Hochman, piano

The same process can be applied to MIDI and to live-streamed audio. The next post will address the process in MIDI.

Please send along any files for analysis — I would be happy to experiment with them in the course of further development, and discuss results.

The fourier analyses use the librosa package for pitch detection.

digital harmony

a new direction

Harmonic analysis of Schubert Fantasie, D. 934, opening bars.

The power of electronic music – even the most dedicated analogue instrumentalist must admit – is beyond question.

Though they do not cover the same musical ground as a finger on a string or breath in a column of air, the filters, echoes, synthesizers, and effects applied to waveforms in electronic music have enormous effect.

Harmony, however, remains insufficiently parametrized. This leaves an important dimension under-explored, and also stifles the integration of digital and acoustic instruments. Tonality guides our own real fingers with memory and prediction, and the methods of electronic music do not well or fully take this into account.

I have been working as a performer of mostly classical music at the Mahler Chamber Orchestra for the past fifteen years, and teaching at the Universität der Künste in Berlin. This work should bridge live performance and musical study in the analog/print style with performance around parameterised digital criteria.

parametrising harmony

I will work to address the process of parametrising harmony over the next weeks and months, exposing a tiny algorithm which back-propagates over a small set of bits, treating the bit as ternary rather than binary. This algorithm, being developed at GitHub as harmony partition, efficiently and flexibly describes a wide range of conventional harmonic usage.

I will document the process of making and using it here, and I hope I can build for you a proper guide, through a series of Jupyter notebooks which outline the theory and applications of this idea. Some of these steps will be pragmatic, some music-theoretical, and some just playful explorations. The main thing is to see if a community and musical language can build around this musical process.

A proper Pypi package will be available in mid-January 2021.


Initial results of the use of this algorithm can be seen at work at the Charlottesville Chamber Music Festival. To begin: Beethoven Sonata, Op. 111, played by Conor Hanick, an analysis of the second movement.

This blog will cover not only the theory, but also the implementation of the algorithm for use in musical practise.