Wishful Coding

Didn't you ever wish your computer understood you?

The relation between harmonics and parallel resistance

I’m building a simple synth on a breadboard, where the frequency is defined as , so by using different resistors with a row of buttons, different tones can be made. But what if you press two buttons simultaneously? You get 2 parallel resistors, giving:

I stumbled on this while playing with it, and the combined tones seem to be nice intervals sometimes. So I started to wonder if there was a connection.

In 12-tone equal temperament, the ratio of the frequency between two notes is , so we could just plug it in and see what comes out. Take a series of notes:

And a series of a combined frequencies:

Plotting these in Matlab gives the following result

12et plot

base = 220;
bp = 1/base;

tones = base.*(nthroot(2,12).^(0:12));
periods = 1./tones;
r = (bp.*periods)./(bp+periods);
duotones = 1./r;

plot(0:12, tones.*2, 'o', 0:12, duotones,'o');
grid on
grid minor

As can be seen, some combined tones are indeed quite close, but most not exactly. But then equal temperament does not have exact harmonics either. So we still do not know if we are generating actual harmonics, or just frequencies that happen to be close.

So what if instead of starting with , we start with integer multiples of the base frequency and fold then back into one octave. This gives:

Plugging that into the parallel resistance equation, we can begin to search for exact harmonics giving exact harmonics.

harm = 1:31;
harm_cap = zeros();

for i = harm
  j = i;
  while j>2
      j= j/2;
  harm_cap(i) = j;

period = 1./harm_cap;

par = (1.*period)./(1+period);

freq = 1./par;
freq_cap = zeros();

for i = harm
  j = freq(i);
  while j>2
      j= j/2;
  freq_cap(i) = j;

[C,ia,ib] = intersect(harm_cap, freq_cap)
Combined Harmonic Name Button ratio Name
17 Minor second 9 Major second
9 Major second 5 Major third
19 Minor third 11 Tritone
5 Major third 3 Fifth
11 Tritone 7 Minor seventh
3 Fifth 2 Octave
2 Octave 1 Prime

And we can indeed verify that two resistors with a 2:1 ratio give a fifth (3:2):

Likewise a resistor ratio for a fifth gives a major third (5:3)

Math, music, physics. So beautiful.


As pointed out by Darius Bacon, this might not be a complete surprise, as there is a striking similarity between parallel resistance and the harmonic mean.

Wikipedia also has the following to say about the harmonic series:

Its name derives from the concept of overtones, or harmonics in music: the wavelengths of the overtones of a vibrating string are 1/2, 1/3, 1/4, etc., of the string’s fundamental wavelength. Every term of the series after the first is the harmonic mean of the neighbouring terms; the phrase harmonic mean likewise derives from music.

Pepijn de Vos