Saturday, March 28, 2020

Music and Geometry - part IV: Second Voice Leading Plane Live Improvisation



Introduction

In the first article we introduced the pitch line. The second article examined what happens to the pitch line if you remove all octave information and replace pitch with pitch class. As we found out the pitch line bends into a pitch circle. In the third article we left the one-dimensional spaces of pitch and pitch circle, and we started looking at intervals, represented as points in a 2d-plane. In this fourth (and for now final) article in this series about geometry and music, we will examine the effect of removing octave information from the voice leading plane and replacing pitch with pitch class.

First, let’s recall what we ended up doing last time.


Live improvisation in the 2d voice leading space

If you are not afraid of computers and trying new things, I’ve created a supercollider program that allows you to explore the 2d voice leading space auditively by navigating it using the computer mouse.

If you want to play with the program yourself, you will first need to install the free and open source supercollider system. You can download it from the supercollider download site.
Before you worry: this is free of cost and completely legal.

The second step is to download the voiceleadingplane.sc code I wrote from my github page. If you have no idea how to use github, the easiest is to click the green “Clone or download” button on my github page, and then the “download ZIP” link that appears. This will download a .zip file to your computer that contains the voiceleadingplane.sc program as well as a LICENSE agreement that basically grants you the right to use this software for any purpose you see fit, including modifying it and calling it your own, as long as you distribute your derived work under the same license for others to learn from and to modify.

Finally you will need to start the “scide” editor that you installed as part of supercollider, and paste the contents of the voiceleadingplane.sc file in it, put the cursor just before the first bracket and press ctrl-enter (or command-enter on a Mac). You can change the sounding interval by clicking the different points in the voice leading space.

The next video gives a demonstration of me exploring my newly created musical instrument. Navigating the voice leading space like this to actually create music is new to me as well. As with any new instrument this one too would benefit from some practice to make (better) music!




I kept the program as simple as possible. Did you like what you see? Did you encounter problems? Do you wish you had additional features to play with? Consider logging a bug or a suggestion on github then.

Removing octave information

Recall from last article that every point in this plane consists of a pair of notes with associated octave number. Now what happens if we remove the octave information?

If we no longer consider the octave numbers, the space contains a lot of points that represent duplicate information, e.g. the points (E3,G3), (E3,G4), (E4, G3), (E4, G4), (G3, E3), (G4,E3), (G3, E4) and (G4, E4) are all equivalent (as well as all other intervals consisting of an E-note and a G-note). In the following figure, these (E,G) and (G,E) intervals are colored.




As there’s no need to keep all those equivalent points around, we will select some that, taken together, represent all possible intervals (discarding octave information).

Selecting each possible interval

In the next figure each point is colored according to the size of the interval it represents. We select a subset of the points that covers all distinct intervals ignoring octave information. Only the points that fall completely in the black rectangle are part of the selection. Given that horizontal movement represents parallel motion, it should not come as a surprise that the colors form horizontal bands. (The colors represent the size of the interval.) The fact that the colored bands are distributed symmetrically around the horizontal axis should not come as a surprise either: this is the consequence of the fact that (because of ignoring octave information) an interval like (E,G) is equal to an interval (G,E). When you move along the 45deg axes, you’re moving in parallel with one of the contributing pitch lines (and therefore perpendicular to the other one), and therefore you expect to hear oblique motion.



Let us look at this selection of points in more detail. In the following image, the selection of points has been stretched horizontally, and squeezed vertically, but it is still the exact same selection of points as in the previous image.



Each ellipse shape in the ribbon corresponds to a point on the 2d voice leading plane. Moving vertically in this plane still represents perfect contrary motion, and moving horizontally represents parallel motion.

Bending the voice leading plane

To fully understand the beauty of what we’ve created here, we need to take a second, very close look at the colorful ribbon. We’re especially interested in what happens at the borders of the ribbon. It will become apparent that the ribbon does not represent all our intuitions about the 2d voice leading plane. Recall that moving horizontally causes the 2 voices to move in parallel motion. Look at the upper side of the ribbon. It starts with (C,C), and as we move horizontally, it goes to (C#,C#), …, all the way to the right where it says (F#,F#).

Now what happens if we try to go even further horizontally? Well, at first sight we just drop off the ribbon into empty space. But look closely… what we should be doing, taking into account that moving horizontally implies parallel motion, is jumping to the lower left corner and continuing our journey going horizontal until we reach the lower right corner of the ribbon, where it says … (B,B), (C,C) again. And what happens if we try to go even further horizontal? Indeed! We jump back to the upper left corner and continue our journey horizontally.

It is as if the upper left corner and the lower right corner are one and
the same point in space. And in the same way the lower left corner and the
upper right corner are the same point in our interval space. Our ribbon does
not represent these intuitions explicitly.


Similarly, you can verify that travelling vertically on the ribbon represents perfect contrary motion of the voices, and that again the same corners seem to be connected to each other as in the previous paragraph. Now also verify how every point on the right side of the ribbon matches up with the upside-down points on the left side of the ribbon.

Our 2d ribbon representation does not explicitly show these connections between corners and left and right side of the ribbon. Can we do something, similar to what we did with bending the pitch line into a pitch circle, to get a graphical representation that makes all these connections explicitly visible?
The answer is: yes! But it’s not as easy as when we bent the pitch line into the
pitch circle. I’ve created a video to illustrate how it can be done.


This time we use 3 dimensions to represent the effect of ignoring octave  information and order between notes in the intervals on our 2d plane. Despite using 3 dimensions to draw our space, the resulting space is really still two-dimensional. Only points glued to the surface have a physical interpretation as an interval. The resulting figure is a so-called Moebius strip. It is a fascinating geometrical object for many reasons.

Amusing videos illustrating some of the wonders of Moebius strips can be found on Youtube. Here’s one (not made my be) that illustrates the unexpected things that can happen if you try to cut Moebius strips in half.


Here’s another one (also not made by me) that demonstrates how Moebius strips, despite first appearance, have no top or bottom side, and no left or right side


Conclusion

Congratulations if you made it until here! We’ve come a far way. We started with pitches and pitch lines in the first article, then discarded octave information and saw how this bent the pitch line into a pitch class circle in the second article. Next we turned our attention to intervals and discussed how to represent these intervals as points on a plane in the third article. Finally we discarded octave information again in the fourth article and ended up with a Moebius strip.

Geometry doesn’t stop at 2 or 3 dimensions. Mathematics is not limited to things we can easily imagine and represent. You can create a voice leading cube with three-note chords, and keep on adding dimensions to analyze four- and more-note chords, and study the geometrical properties of these spaces. But as the number of dimensions in these spaces increases, things get harder to represent with movies and drawings. That’s where you need to start using more rigorous maths.

Music and Geometry - part III: Intervals, Counterpoint and Voice Leading



In the first and second article we’ve studied single pitches. This is great for analyzing melodies or scales, but its usefulness is limited when considering multiple pitches sounding simultaneously. In this article we will turn our attention to intervals (2-note chords).

Representing intervals

A straightforward idea would be to represent intervals as line segments on the pitch line, or as circle segments or chords on the pitch class circle. The following could represent an interval made of pitch classes C and E.


While this representation has been used as the basis for other exotic music theories (e.g. Peter Schat’s tone clock theory), as far as the geometrical structure of the space of intervals is concerned this approach won’t bring us many new insights.

To represent intervals we will instead represent groups of 2 notes as one point in a 2-dimensional space. Representing an interval as a point in a 2-dimensional space sounds abstract, so let’s examine first what this means.

Probably the simplest way to represent an interval as a point in a two-dimensional space, is to consider two pitch lines, each of which contribute a note to the interval. A horizontal pitch line contributes a note, and a vertical pitch line contributes another note. Both together determine a point in the 2-dimensional plane. Any point on the plane can be analyzed as consisting of a combination of 2 pitches.

As an example, we look at the representation of the interval (E4,G4). The fact that each point consists of the contribution of two pitch lines is what makes this a two-dimensional space (you need two coordinates to unambiguously define a point in this space). This is a 2-dimensional extension of the pitch line we discussed in the first article. Because every point in this space represents an interval, we call it the interval space.

The first note for every interval is contributed by the horizontal pitch line, and the second note in the interval is contributed by the vertical pitch line. In the above drawing each note in each note pair has an octave number associated to it. Just as with the pitch line, also microtonal intervals can be drawn in the interval plane.

A composition in 2 voices can be represented as a path in the two dimensional interval space. Consider e.g. a counterpoint exercise in the D dorian mode taken from Johann Joseph Fux’ book “Gradus ad Parnassum”. Suffice to say there’s a lot more to counterpoint than just drawing lines in 2d interval space but in this article we won’t go any deeper.






When moving from interval to interval, the jumps (thick black lines) are kept relatively small, especially if you mentally cross out intervals (points) that cannot be used because they contain notes that are not available in the D dorian mode. This is no coincidence: one of the (many) rules in counterpoint is to limit the size of the jumps in melodies, to keep the intervals easy to sing.

Voice leading

Voice leading is a compositional principle governing many styles of music. It is used by classical, pop, folk and jazz musicians alike. The basic idea is that when you go from one chord (or interval) to the next, you do so by moving the different voices the shortest distance possible, so as to gently lead the listener from one chord to the next. Consider the following examples of good and bad voice leading. Both measures move between the same chords. Play them on the piano to hear the difference! In the smooth version adjacent notes take small leaps or remain the same as much as possible.

Because of how the two-dimensional plane of intervals is constructed, points that lie closer together in the plane have a shorter voice-leading distance. Another way to say the same is that a jump between two points in the plane (i.e. a move from one interval to another interval) will have better voice leading if the distance you jump is smaller. This follows from the fact that adjacent points in the 2d interval space are made from adjacent notes on the contributing pitch lines.

Note that our 2d interval space contains all chromatic notes. In many pieces, composers restrict themselves to a subset of the chromatic notes (e.g. only the white keys on a piano). In such cases the interval space can redrawn showing only the relevant intervals.

Voice leading is not only used to write choir pieces! Listen, e.g. how smoothly J.S. Bach moves from chord to chord in his prelude #1 from the well-tempered clavier:
or the dazzling tribute to Bach’s prelude made by Frederic Chopin in which he guides us through a wild ride from c major through the most distant keys and back to c major with ease (well… for the listener at least!)

Motion

Now that we’ve introduced the concept of voice leading, it’s useful to mention the concept of motion, and to study how it translates to our 2d interval space. When moving from one interval to the next, one has a choice between four types of motion.



In parallel motion, both voices move together, keeping the same interval between them. In similar motion, both voices move up or down together, but not necessarily keeping the same interval. In contrary motion, when one voice moves up, the other moves down and vice versa. In oblique motion, one voice remains stationary while the other voice moves.

In many music styles certain parallel motions are forbidden: parallel fifths and parallel octaves are commonly forbidden. This is not just because music teachers like to be pedantic, but also because they sound really bad in a piece that for the rest uses more traditional rules. People who didn’t study music composition can still hear that something “strange” happens when hearing a parallel fifth, although they will struggle to define exactly what causes this sensation of “strange”. It’s also advised not to keep using parallel motion for too long because that starts to tie the two voices together, threatening their melodic independence.

In contrapuntal writing at the same time contrary motion is applauded, as it helps suggesting that the melodies in the two voices are independent.

Parallel and contrary motion in 2d interval space

How is parallel and contrary motion visible in our 2d interval space? Look at the diagram and verify for yourself: any two points in the 2d interval space that are connected by a straight line under 45 degrees represents parallel motion. And any two points in the 2d interval space that are connected by a straight line under -45 degrees represents perfect contrary motion (i.e. contrary motion whereby each voice moves the same number of scale degrees).



If you check the 2d path again that we drew in the counterpoint exercise, you can immediately see from the path segment angles that the composer switches between parallel motion and contrary motion after every chord.

Because voice leading and motions play such a central role in classical music theory, professor Tymoczko decided to rotate the 2d interval pitch space a bit, to make parallel and contrary motion happen along horizontal and vertical directions in the 2d space. This new space contains all the same information as the original space, just rotated a bit. The new space is called the “voice leading space”.

This article was mostly about explaining the preliminaries for the next article where we will examine what happens to the voice leading space if we replace pitch with pitch class again. Remember from the previous article that the pitch line was bent into a pitch class circle.

What do you expect will happen to the 2d voice leading space? Will it simply bend into a ring? Or can we expect something more twisted? Stay tuned for the next episode!

Music and Geometry - part II: pitch class circle and composing

In the previous article we introduced the concept of pitch and pitch class. We saw how notes could be represented on a pitch line, forming a one-dimensional geometrical space, and how removing octave information caused the line to turn into a circle.

The pitch class circle, despite first appearance, is still a one-dimensional space (but it’s a curved one). The reason is that, like on the pitch line, you still need only one number (a so-called coordinate) to unambiguously address a point on the circle compared to a chosen reference point. We’ll explore this idea and some of its consequences later in this article. We will look at some properties and applications of the pitch class circle, getting a first taste of how strange life in curved spaces can be.

Composition operations on the pitch class circle

Geometrical operations

As with the pitch line, the pitch class circle allows to perform certain composition operations.
Transposition of pitch classes is done by traveling along the pitch class circle. After the transposition is done, the composer is free to assign octaves to convert from pitch class back to pitch.
Both example 1 and 2 in the following picture can be represented on the pitch class circle below.



Inversion mirrors around a diameter of the circle:




Mathematical equivalent of geometric operations

Instead of drawing pitch class circles, and sliding or mirroring pitches, one can also do something easier. Remember how I said that the pitch class circle is a one-dimensional space? And we needed only one number (a coordinate) to unambiguously name any pitch on the circle? Well, let’s choose the “C” class as reference (i.e. we give it the coordinate 0) and assign a coordinate to the remaining pitches. Note that with our choice of numbers, microtonal pitches can be represented as floating point numbers. E.g. F quarter sharp would have a coordinate 5.5, because it falls exactly between F (with coordinate 5) and F# (with coordinate 6).

Note that coordinate 12 does not occur on the pitch class circle. Coordinate 12 is equivalent to coordinate 0 on the pitch class circle. Whenever we do mathematics operations while working with pitch classes and we end up with numbers >= 12, we need to keep subtracting 12 until we end up lower than 12 again. In math speak, we say that we calculate “modulo 12”, and that “12 is congruent with 0 modulo 12”.

When you calculate modulo 12, you can write funny sums like: 11 + 3 = 2 (mod 12). Why? Well, 11+3 in the normal universe equals 14, but we’re calculating modulo 12, so we need to subtract 12 until the result is smaller than 12, and we get 14-12=2. Life in curved spaces at first sight seems different from what we’re used to in everyday life but attentive readers probably have noticed that clock reading uses the exact same form of modulo 12 arithmetic. 3 hours later than 11 o’clock indeed is 2 o’clock. Perhaps this is the reason that in at least one other exotic music theory I’m aware of the pitch class circle is also known as a tone clock.


Using the coordinates we can now also do the same composition operations we did using geometry before using only purely mathematical operations. Transposition boils down to adding a constant number to each note-coordinate.




Inversion boils down to subtracting the note-coordinate from the constant number 12.



Beyond geometry

Now that we can use numbers instead of geometry, nothing stops us from performing other operations on pitches and pitch classes. What happens to a melody if you multiply all pitch coordinates with 2? What happens if you take your 2 favorite melodies and calculate their average? What happens if you take two melodies and you multiply them pitch by pitch? Your imagination and curiosity are the only limits here. Let’s see some simple examples.

Transforming a single melody using maths





Using the pitch class circle to analyze scale symmetry

Neither the pitch line nor the pitch class circle in themselves are the right or wrong representation. The pitch class circle offers possibilities for analysis and composition that were not readily present in the pitch line representation.

As an example, the pitch class circle immediately and very visually shows you if a collection of notes belong to a symmetrical scale. This is illustrated in the following picture, where some important symmetrical scales/modes are illustrated (there are many more). The symmetry is visually present.


There are more music-theoretical things one can do with the pitch class circle, but in this article I won’t go any deeper.

In this article we saw how pitch classes can be assigned numbers, how we can calculate with these numbers. We saw how closely connected the concepts of musical pitch class, curved spaces and modular arithmetic are connected.

In the next articles we will investigate “intervals” instead of “pitches”. We will leave our one-dimensional spaces (pitch line and pitch class circle) behind, and will end up exploring two-dimensional curved spaces, where life is even more strange and fascinating.

Music and Geometry - part I: pitch class

Introduction

In this series of 4 articles I’m going to introduce you to what for many will be the most exotic piece of music theory you’ve ever come across. Even if you think you’re not good at theory, you may want to try following along and – who knows – perhaps pick up an insight or two.

Music shows deep inner structure on multiple levels that appeals to mathematically inclined people. Math professor Guerino Mazzola has written a book called the “Topos of Music”. It’s safe to assume that only a handful of people in the world really understand the finer details of what it describes. You literally need a PhD in mathematics (in category theory to be more precise) to even begin making sense of it. Professor Mazzola argues that all this complexity is unavoidable because the music it models is just as complex.

Luckily also other books showing neat connections between music and mathematics have been written. And luckily these books are accessible to a wider audience. One of the more intriguing ones, in my humble opinion, is “A Geometry Of Music” by professor Dmitry Tymoczko of Princeton University. In these articles we will dip our toes in some of the very basics of his ideas. To be perfectly clear: I’m not affiliated to professor Tymoczko or the book in any way, and all awesome ideas are his, whereas all mistakes in the explanation are mine.

Pitch line


If you just consider notes in a chromatic scale, starting with the very lowest note you can imagine, and rising to the very highest note you can imagine, it’s not so difficult to depict these notes as points on a line. Although the picture below highlights only a few special notes on the line, actually all conceivable pitches, including microtonal ones or pitches so high they can only be heard by dogs, have their place on the pitch line which has no beginning and no end. It’s an infinite line. In geometry, such a line is considered a 1-dimensional space.


Some simple composition operations can be done by reasoning on a pitch line directly. Take transposition, e.g., and observe how it corresponds to sliding along the line. Or consider inversion of a melody and observe how it corresponds to mirroring pitches around some other pitch on the pitch line.





Pitch class

Yet this pitch line doesn’t model all existing intuitions about pitches. One intuition that is not visible on this line, is the feeling that notes one octave apart in some sense sound the same. Who doesn’t remember the lyrics to the Do-Re-Mi song from the sound of music? When reaching the end of the song, it’s made very clear that “this will lead us back to do”, as if all do’s (C notes) are equal in some sense.

A more difficult way to say the same thing is to say that in some contexts it makes sense to abstract away the exact pitch, and instead reason on pitch class. In other words we don’t speak of a concrete C4 or D3 note anymore, but of a more abstract concept of a “C” note, or a “D” note, with no indication of exactly which octave it belongs to.

The question arises what introducing this “pitch class” abstraction does to our pitch line. How does incorporating pitch class change the pitch line?

The solution is straightforward, but not necessarily trivial to come up with by yourself. To model the concept of pitch class, we need to transform our pitch line so that all differences between octaves disappear. This can be done by curling up the pitch line in three dimensions, so that all equivalent notes (e.g. all “C” notes) perfectly line up. After this is done, we will squash the curled line until it’s flat again. If you think deeply about it, the lining up and especially the squashing of equivalent pitches indeed is a kind of geometrical equivalent to replacing concrete notes with pitch classes. Just like with the pitch line, the pitch class circle has plenty of room to host all microtonal pitches you can come up with. In case you’ve been wondering: the pitch class circle as such has nothing to do with the so-called “circle of fifths”. Other than the fact that both are represented on a circle, there’s no special relation between the two circles.

Please watch the first video animation to better understand how replacing concrete pitch with pitch class has the effect of curling up the pitch line into a pitch class circle.


Before going on to our next topic, let’s sum up a few quick facts about the concept of pitch class and related subjects:
  • “Pitch” indicates a specific point on a pitch line.  C4, for example, is a different pitch than C5.  The higher the number, the higher the sound.
  • “Pitch class” indicates an entire group of pitches, related by their “octave equivalence”.  The pitch class of C, for example, includes C4, C5, C9 and so on.
  • “Pitch class” includes notes with enharmonic spellings.  The pitch class of “C”, for example, would include such pitches as C3, B#5, D double flat 6, and so forth.
Pitch classes are “octave equivalent”, which means that pitches in different octaves are still in the same class.   Pitch classes are also “spelling equivalent” which means that notes spelled differently but sounding the same, which we call enharmonic spellings, are in the same pitch class.

Here is an example of a piece which is built entirely on one pitch class, until the final few measures.

Thursday, July 26, 2018

Between Secrets

Introduction

After recently acquiring a Dave Smith Instruments REV2 16-voice analog synthesizer, I have been very interested in exploring all its possibilities. I was happily surprised to discover that it supports the Midi Tuning Specification standard. This is a standardized set of MIDI messages that allow
to assign any frequency to any midi note. Having never written microtonal music before, I decided to dive in head first and try my hand at writing something.



Microtonal music is one of the least exploited ways to create new music. To the uninitiated it typically conjures images of weird and incomprehensible alien music mostly sounding badly out of tune. While such description no doubt applies to some hardcore experimental compositions, there actually is a whole spectrum of microtonal music possibilities.

People writing microtonal music (even though there are very little to start with) come in a few flavors:

The first kind is looking to create the same kind of music we know from day to day life, but using much purer intervals. Western music in 99.9999% (approximately :) ) of the cases is based on the same 12 notes that evenly divide the octave. This system is known as 12-tone Equal Temperament (also known as 12 tET).

In 12 tET, some note combinations sound smoother together than others. In music terms one speaks of consonance and dissonance. If you analyze these note combinations (or intervals) mathematically,
it turns out that even the consonant ones in fact sound ever so slightly out of tune. Over time, however, our ears have become accustomed to that specific sound. Interestingly, throughout history what is considered to sound "normal" or "good" has changed! By retuning instruments to purer intervals, some consonant chords can be made to sound even more consonant, whereas (as a side effect) some others actually sound worse. There's a whole universe of trade-offs to be made. And a more radical way of working involves retuning instruments on the fly (this is typically only possible with electronic synthesizers) to have the purest possible chords at all times.

A second kind of composers are looking to leave the traditional ways and to exploit new music notes to create new harmonies. This is sometimes called xenharmonic music.

Think about painters: throughout history they've used some types of canvas: in the earliest days there were rocks, later pottery and wood and nowadays the majority of painters has settled on using a canvas made of some kind of paper or fabric. Painting techniques can be adapted to different media: it's a very different experience painting paper than it is to paint rock. Any of these media (rock,wood,pottery,paper,fabric) in principle supports painting any style of painting, although in practice some media seem to be associated to certain styles more than others.

Something similar is true for microtonal music: over time different tuning systems have been popular, but by now the majority in the Western world has settled on 12tET. Nothing prevents us from using other tuning systems, however, and still write medieval, impressionistic, romantic, expressionistic or atonal music in it.

Bohlen-Pierce scale

The Bohlen-Pierce scale divides the "tritave" (= an octave + fifth) in 13 equal steps. I'll spare you the mathematical details. 

In some cases, people have just taken compositions written for 12tET and, after some minor adjustments, replayed them through retuned instruments. Here's an example of Pachelbel's canon in a Bohlen-Pierce scale:



The result still sounds a little alien to me, maybe because the music was originally conceived for the 12tET system and just doesn't fit the new scale

If you change the canvas, you probably ought to invest some time in adapting your painting techniques. Indeed, you read that right: when using a different tuning (e.g. dividing the octave in 13 steps instead of 12), you had better throw out all harmony theory and start with a clean slate.

Some basic principles that span many music theories can still be used to guide music compositions in other tuning systems.

There are the concepts of "consonance" and "dissonance" (because intervals made of notes other than the ones we typically use can still sound consonant or dissonant, in fact even more so!). Consonance and dissonance can be used create tension and release, a tried and proven technique when writing music.

There's the concept of "voice leading" which is fundamental to create smooth sounding chord changes.

It is still possible to use the principles of modulation and cadences to accomplish smooth key changes.

Everything you know about rhythm can be transferred without any change. By trial and error and using your ears carefully you can write music that is adapted to a different tuning, and which still stands a chance of being acceptable to a wider audience.

Of course, since it's using a very different tuning from 12 steps per octave, it will sound a bit different, a bit weird, a bit out of tune but that actually will give the music a new color, a new character, a new appeal. If you have been cursed with absolute hearing basically all hope is lost at this point ;). Note that in addition to using your ears, it also helps to carefully select the instruments that will execute the music. The spectrum of a sound can do a lot for consonance or dissonance. With the right timbres, even in 12tET an octave (=the most consonant interval possible ) can be made to sound very dissonant.

Some people will dislike the new sound, and that's fine too. My own ears, however, have opened a bit, and I will probably try to write more microtonal music in the future.

So without further ado, let's hear my take on some Bohlen-Pierce music:



Saturday, May 20, 2017

The Vows

My latest piece was destined to be played in a concert in a church. When you think of churches you think about the big moments in life: birth, marriage, death. In "The Vows" I committed myself to the theme of marriage.

The idea of "marriage" was used throughout the construction of the piece. In the background e.g. we hear a sound "carpet" made by a mathematical combination of J. S. Bach's orchestral suite in B minor piece (aka "Badinerie", sometimes used in marriage ceremonies) and Stravinsky's firebird (a story that ends in marriage of a prince and a princess set to music). The mathematical technique deconstructs both pieces into information bins and then mixes those bins together so as to weave them back together into a sound carpet.

King Eduard VIII was a king who had was forced to abdicate because of his desire to marry the American girl Wallis Simpson. The speech he held for the abdication survived history thanks to an audio recording. It is this audio recording that was cut into pieces, and then rewoven into the king expressing his wedding vows. Where the original speech sounded very self-assured, the new version sounds rather uncertain - a feeling that some people feel when they are about to get married.

By using this speech we get a marriage between spoken word and instrumental sounds. This is emphasized in the last part of the music where the spoken word is lifted to a choir piece by supporting it with tonal chords. The scale in which the chord are written was adapted to match the underlying sound carpet as good as possible, resulting in a harmonious marriage between the tonal chords and the atonal sound carpet. 

Just like in a wedding service, the ceremony sometimes is interrupted for some music (!). This is accomplished by using an experimental Waltz between the different parts. 

The piece is supported by images. There's a marriage between image and sound, between animations and film fragments, between authentic archive material from King Eduard's marriage and fake romance from an old movie.

To generate the animations in the video, I developed a new python library, the code of which is freely available via my other blog: http://technogems.blogspot.be/2017/05/mask-driven-vector-animations-with.html

Finally the music video can be found on youtube:


Saturday, May 28, 2016

Modeling rhythms using numbers - part 2

This is a continuation of my previous post on modeling rhythms using numbers.

Euclidean rhythms

The Euclidean Rhythm in music was discovered by Godfried Toussaint in 2004 and is described in a 2005 paper "The Euclidean Algorithm Generates Traditional Musical Rhythms". The greatest common divisor of two numbers is used rhythmically giving the number of beats and silences, generating the majority of important World Music rhythms.

Do it yourself

You can play with a slightly generalized version of euclidean rhythms in your browser  using a p5js based sketch I made to test my understanding of the algorithms involved. If it doesn't work in your preferred browser, retry with google chrome.  

The code

The code may still evolve in the future. There are some possibilities not explored yet (e.g. using ternary number systems instead of binary to drive 3 sounds per circle). You can download the full code for the p5js sketch on github

screenshot of the p5js sketch running. click the image to enlarge

The theory

So what does it do and how does it work? Each wheel contains a number of smaller circles. Each small circle represents a beat. With the length slider you decide how many beats are present on a wheel.  

Some beats are colored dark gray (these can be seen as strong beats), whereas other beats are colored white (weak beats). To strong and weak beats one can assign a different instrument. The target pattern length decides how many weak beats exist between the strong beats. Of course it's not always possible to honor this request: in a cycle with a length of 5 beats and a target pattern length of 3 beats (left wheel in the screenshot) we will have a phrase of 3 beats that conforms to the target pattern length, and a phrase consisting of the 2 remaining beats that make a "best effort" to comply to the target pattern length. 

Technically this is accomplished by running Euclid's algorithm. This algorithm is normally used to calculate the greatest common divisor between two numbers, but here we are mostly interesting in the intermediate results of the algorithm. In Euclid's algorithm, to calculate the greatest common divisor between an integer m and a smaller integer n, the smaller number n is repeatedly subtracted from the greater until the greater is zero or becomes smaller than the smaller, in which case it is called the remainder. This remainder is then repeatedly subtracted from the smaller number to obtain a new remainder. This process is continued until the remainder is zero. When that happens, the corresponding smaller number is the greatest common divisor between the original two numbers n and m.

Let's try it out on the situation of the left wheel in the screenshot. The greater number m is 5 (length) and the smaller number n is 3 (target pattern length). Now the recipe says to repeatedly subtract 3 from 5 until you get something smaller than 3. We can do this exactly once:

5 - (1).3 = 2

We can rewrite this as:

5 = (1).3 + 2

This we can interpret as: the cycle of 5 beats is to be decomposed as 1 phrase with 3 beats, followed by a phrase with 2 beats (the remainder). Each phrase consists of a single strong beat followed by all weak beats. In a symbolic representation easier read by musicians one might write: x..x. (In the notation of the previous part of this article one could also write 10010).

Euclid's algorithm doesn't stop here. Now we have to repeatedly subtract the remainder 2 from the smaller number 3:

3 = (1).2 + 1

This in turn can be read as: the phrase of 3 beats can be further decomposed as 1 phrase of 2 beats followed by a phrase consisting of 1 beat. In a symbolic representation: x.x Euclid continues:

2 = (2).1 + 0

The phrase of two beats can be represented symbolically as: xx. We've reached remainder 0 and Euclid stops: apparently the greatest common divisor between 5 and 3 is 1.

Now it's time to realize what we really did: 
  • We decomposed a phrase of 5 beats in a phrase of 3 beats and a phrase of 2 beats making a rhythm x..x. 
  • Then we further decomposed the phrase of 3 beats into a phrase of 2 beats followed by a phrase of 1 beat. 
  • We can substitute this refined 3 beat phrase in our original rhythm of 5 = 3+2 beats to get a rhythm consisting of 5 = (2 + 1) + 2 beats: x.xx. 
  • I hope it's clear by now that by choosing how long to continue using Euclid's algorithm, we can decide how fine-grained we want our rhythms to become. 
  • This is where the max pattern length slider comes into play. 
The length slider and the target pattern slider will determine a rough division between strong and weak beats by running Euclid's algorithm just once, whereas the max pattern length slider helps you decide how long to carry on Euclid's algorithm to further refine the generated rhythm.