## Harmonic Trees

Jacob T. Joaquin
imjake@nyc.rr.com

Printer friendly

Introduction

Sometime ago, fractals and chaos were running rampant through the many corners of my mind. Bifurcating structures and branching possibilities relentlessly plagued all of my musical ideas. I needed to apply these qualities to something tangible that I could hear. At the time, I was also fond of the harmonic series, since I was also exploring additive synthesis. The harmonic series was a natural choice due to its inherent musical properties. I came up with what I call the "Harmonic Tree", which is nothing more than a simple branching of relative harmonics intervals.

Disclaimer: I would not be surprised if others are already using the harmonic series in this manner.

What is a Harmonic Tree?

A "Harmonic Tree" is a series of intervals that branch off from one another relative to the harmonic series. It is a structure based on simplicity, requiring only multiplication and division.

A "Harmonic Tree" is created through the process of repeatedly choosing a harmonic interval while feeding back the previous value. Each new interval can be chosen either explicitly, at random or using any other process.

The "destination" refers to the harmonic to which the new frequency is relative. The "relative" is the relative harmonic to which the new destination harmonic is relative. Combined, they create the interval destination/relative. For each branch created, the previous destination harmonic becomes a new relative harmonic. See figure 1.
r = relative harmonic
d = destination harmonic
```r1:d1
|
r2:d2
|
r3:d3
|
r4:d4
|
...
|
rn:dn

```
Figure 1 - Harmonic Tree Diagram
```1:2
|
2:3
|
3:4
|
4:5
|
5:6
|
6:7
|
7:8
```
Figure 2 - Harmonic Tree of the Harmonic Series up to the 8th Harmonic
Mathematically, each new value is derived by multiplying the previous value with an integer 1 or greater (destination) divided by an integer 1 or greater (relative).
x = value
d = destination harmonic
r = relative harmonic
```f(xn+1) = f(xn) * d / r
```
Figure 3 - Basic Harmonic Tree Equation
If you wanted to use the "Harmonic Tree" for getting pitches, assign x a starting value. In this next example, x is assigned 100. The relative and destination harmonics are assigned random harmonic integers between 1 and 5.
```f(xn+1) = f(xn) * int(rand(5) + 1) / int(rand(5) + 1)

1:5
|
3:2
|
4:2
|
3:4
|
1:3

f1                   = 100
f2 = 100 * 5 / 1     = 500
f3 = 500 * 2 / 3     = 333.333
f4 = 333.333 * 2 / 4 = 166.666
f5 = 166.666 * 4 / 3 = 222.222
f6 = 222.222 * 3 / 1 = 666.666
```
Figure 4 - Giving x a Starting Value
Musical Properties

The harmonic series is very musical in itself. Within the harmonic series, you have your octaves, 7ths, 6ths, 5ths, 4ths, 3rds, 2nds and microtones.

In a pure harmonic tree, every new value is harmonically related to the previous value. A "Harmonic Tree" can produce microtones when the values are mapped to frequencies.

Methods of choosing the Intervals

There are many methods of choosing the interval relationship of the relative and the destination. I'll focus on two: constant and random.

Constant

When the relative and destination are constants, the branch will always grow or diminish at the same interval. Let's consider a relative:destination ratio of 4:5. The interval will continue to grow by a major 3rd.
```41:51
|
42:52
|
...
|
4n:5n

```
Figure 5 - Constant Harmonic Tree of 4:5
Random

Having the computer choose pseudo-random numbers for the relative and destination is a great way to explore the many directions of the tree. If applied properly, it will sound musical with interesting variations.

You can set the range of random numbers for both the relative and destination. There are an infinite number of harmonics,although in a digital system, the harmonics would begin to alias early). Musically, different ranges will produce different qualities. By selecting a range of possible random numbers for the relative and destination, one gives direction to the "Harmonic Tree".

For instance, ranges limited between 1 and 2 for both the relative and destination will only yield unison and octaves. This generates a clearly distinct sounding harmonic tree, with little harmonic variation.
```1:2
|
2:2
|
2:1
|
2:1
|
1:1
|
1:2
|
2:1
```
Figure 6 - Ranges of 1 to 2 for relative and destination
To yield smaller intervals, you can bias the range to only include upper harmonics. For example, by setting the range of the relative between 3 and 7 and the destination between 3 and 6, you get the following possible intervals: 1/1, 3/4, 3/5, 4/5, 4/3, 5/4, 5/3
```f(xn+1) = f(xn) * int(rand(2)+3) / int(rand(3)+3)
```
Figure 7 - Biasing the Range of Intervals
Perl And Csound

As powerful as Csound is, I needed something else to help me compose and sound design with the "Harmonic Tree" structure. Sometimes the best way to do something in Csound is to use something other than Csound. That's where Perl comes in. With Perl, I was able to write my own custom scripts that generate Csound code.

At first, I experimented with generating Csound code by generating instruments. When I started doing additive synthesis, it became clear to me that the score provides much more flexibility and control over sine waves. I went from having instruments with a flotilla sine wave oscillators to a single instrument with only 1 sine wave oscillator. In a sense, I actually do most of my additive sound design with Perl.

Rain Drops

"Rain" is a composition that is synthesized entirely out of sine waves (and a reverb). Each raindrop consists of sine waves. The frequencies of these sine waves is chosen using the "Harmonic Tree" method. Each new sine wave in a raindrop is delayed by a fraction of the second, so the listener can hear the progression of the "Harmonic Tree" as a timbral quality.

Listen:
Rain.ogg - better!, Visit Vorbis.com
Rain.mp3

Code:
Rain.zip - includes files below
Rain.orc
Rain.sco
Rain.pl
Rain.pm
Chaos.pm
ComputerMusic.pm
ScoreFilter.pm
gpl.txt

Bending the Harmony Tree

Certain physical objects produce inharmonic tones. When a bell is struck, many frequencies produced are inharmonic. To add inharmonic frequencies to the tree, I introduced another variable called bend.
b = bend
```f(xn+1) = f(xn) * d / r * b
```
Figure 8 - "Harmonic Tree" equation with the Bend argument
This concept is similar to using non-integer ratios in FM synthesis to produce inharmonic frequencies. The bend in the "Harmonic Tree" is nothing more than a real number multiplier. When bend is set to 1, the resulting frequencies are unaffected. Any other number changes the evolution of the values in the branch. Integers will continue to produce harmonic tones, while non-integers will produce more clangorous sounds and inharmonic pitches.

As an example of bend, I present to you "Entropy In Reverse".

Listen:
EntropyInReverse.ogg - better!, Visit Vorbis.com
EntropyInReverse.mp3

Code:
EntropyInReverse.zip - includes files below
EntropyInReverse.orc
EntropyInReverse.sco
EntropyInReverse.pl
gpl.txt

Continuation

I did not cover all that I wished to cover while writing this article. I did not cover the topic of bifurcation and only provided two musical examples. However, the essence is there and will provide you with the basic framework if you wish to explore the tree yourself. Be Creative! And share...