Tuning For Physicists & Engineers using your Laptop, Microphone, and Hammer

by

Bruce Vogelaar 313 Robeson Hall Virginia Tech Piano Tuning [email protected]

at Room 130 Hahn North April 21, 2011

1 What our $50 piano sounded like when delivered.

Piano Tuning So far: cleaned, fixed four keys, raised pitch a half- step to set A4 at 440 Hz, and did a rough tuning…

2 Bravely put your ‘VT physics education’ to work on that ancient piano!

Tune: to what? why? how?

Piano Tuning Regulate: what? Fix keys: how?

3 L A piano string is fixed at its two ends, and can vibrate in several modes.  L  n ; 2 v v  fn   n  nf0  2L The string vibrating at a given ,

Piano Tuning produces sound with the same frequency.

Depending where you pluck the string, the amplitude of different varies.

What you hear is the sum.

4 p(t)  a1 sin(2f1t)  a2 sin(2f2t)  a3 sin(2f3t) ... Why some notes sound ‘harmonious’

Octave (2/1)

5th (3/2)

th Piano Tuning 4 (4/3)

Octaves are universally pleasing; 3rd (5/4) to the Western ear, the 5th is next

5 most important. Piano Tuning

A frequency multiplied by a power of 2 is the same note in a different .

6 “Circle of 5th s”

th Going up by 5 s n 12 times brings you very near the same note (but 7 up) f

(this suggests perhaps 7 12 12 notes per octave) 2 1.5 Up by 5ths: (3/2)

“Wolf ” fifth log2(f)

Piano Tuning We define the number of ‘cents’ between two notes as

1200 * log2(f2/f1)

Octave = 1200 cents “Wolf “ fifth off by 23 cents.

7 log2(f) shifted into same octave log2 of ‘ideal’ ratios Options for equally spaced notes

1= log 2/1

log 3/2

log 4/3 log 5/4 log 6/5 log 9/8

0 Piano Tuning Average deviation from ‘just’ notes

8 We’ve chosen 12 EQUAL tempered steps; could have been 19 just as well… Typically set A4 to 440 Hz Piano Tuning

from: http://www.sengpielaudio.com/calculator-notenames.htm 9 What an ‘aural’ tuner does…

for : Octave (2/1) tune so that desired are at the same frequency; 5th (3/2) then, set them the required amount off th Piano Tuning 4 (4/3) by counting ‘beats’.

3rd (5/4)

10 From C, set G above it such that an octave and a fifth above the C you hear a 0.89 Hz ‘beating’ Piano Tuning I was hopeless, and even wrote a to try and train myself…

but I still couldn’t ‘hear’ it… 11 These frequencies are for the central octave. Is it hopeless?

not with a little help from math and a laptop…

Piano Tuning we (non-musicians) can use a spectrum analyzer…

12 With a (free) “Fourier” spectrum analyzer we can set the pitches exactly!

True Equal Temperament Frequencies 012345678 C 32.70 65.41 130.81 261.63 523.25 1046.50 2093.00 4186.01 C# 34.65 69.30 138.59 277.18 554.37 1108.73 2217.46 D 36.71 73.42 146.83 293.66 587.33 1174.66 2349.32 D# 38.89 77.78 155.56 311.13 622.25 1244.51 2489.02 E 41.20 82.41 164.81 329.63 659.26 1318.51 2637.02 F 43.65 87.31 174.61 349.23 698.46 1396.91 2793.83 F# 46.25 92.50 185.00 369.99 739.99 1479.98 2959.96 G 49.00 98.00 196.00 392.00 783.99 1567.98 3135.96

Piano Tuning G# 51.91 103.83 207.65 415.30 830.61 1661.22 3322.44 A 27.50 55.00 110.00 220.00 440.00 880.00 1760.00 3520.00 A# 29.14 58.27 116.54 233.08 466.16 932.33 1864.66 3729.31 B 30.87 61.74 123.47 246.94 493.88 987.77 1975.53 3951.07

13 Destructive Constructive

2

1

0 time domain -1

-2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

frequency spectrum Piano Tuning

Forward and Reverse Fourier Transforms

14 Any repeating waveform can be decomposed into a Fourier spectrum. Piano Tuning

But that doesn’t mean they sound good…

frequency content determines ‘timbre’

15 Given an arbitrary waveform, how does one find its spectral content (Fourier transform)? • Collect N samples x dT = T seconds,

f0  1/T.

• Multiply the input by harmonics of f0 [sin(2nf0t)], and report 2x the average for each.

1 sec eg: 200 x 1/200 = 1 sec

f0 (1 Hz in this case)

Piano Tuning 2f0

3f0

4f0 16 200 Samples, every 1/200 second, giving f0 = 1 Hz

1 sec

Input 4Hz pure sine wave

Look for 2Hz component Piano Tuning

Multiply & Average

17 2xAVG = 0 1 sec Input 4Hz pure sine wave

Look for 3Hz component

Piano Tuning 4+3 = 7 Hz

Multiply & Average

4 - 3 = 1 Hz

18 2xAVG = 0 1 sec Input 4Hz pure sine wave

Look for 4Hz component

Piano Tuning 4+4 = 8 Hz

Multiply & Average 4 - 4 = 0 Hz

19 2xAVG = 1.0 1 sec Input 4Hz pure sine wave

Look for 5Hz component Piano Tuning

Multiply & Average

20 2xAVG = 0 Great, picked out the 4 Hz input. But what if the input phase is different?

o Use COS as well. For example: 4Hz 0 = 30 ; sample 4 Hz

1 sec 1 sec

sin cos Piano Tuning

0.43 0.250.25

2 2 1/2 21 2 x (0.43 + 0.25 ) = 1.0 Right On! From a “math” perspective:

࡭ൌ࣓࢚൅࣐

࡮ൌ࣓ࡾ࢚

૚ ܋ܗܛ ࡭܋ܗܛ࡮ൌ ࢉ࢕࢙ ࡭൅࡮ ൅ࢉ࢕࢙ ࡭െ࡮ ૛ ૚ ܋ܗܛ ࡭ܛܑܖ࡮ൌ ܛܑܖ ࡭൅࡮ ൅ܛܑܖ ࡭െ࡮ ૛ time average is 0, unless  = 

Piano Tuning R

ࢉ࢕࢙ ࣐ ܋ܗܛ ࡭܋ܗܛ࡮ൌ ૛ ܛܑܖ૛ ࣐൅܋ܗܛ૛ ࣐ൌ૚ ࢙࢏࢔ ࣐ ܋ܗܛ ࡭ ܛܑܖ ࡮ൌ 22 ૛ Signal phase does not matter. What about input at 10.5 Hz?

Sample 2xAverage 70.09 80.13 90.21 10 0.64 11 0.64

Piano Tuning 12 0.21 13 0.13 14 0.09

Finite Resolution 23 Remember, we only had 200 samples, so there is a limit to how high a frequency we can extract. Consider 188 Hz, sampled every 1/200 seconds: Piano Tuning

Nyquist Limit Sample > 2x frequency of interest;

24 Fast Fourier Transforms • 100’s of times faster

Piano Tuning • uses complex numbers… Free FFT Spectrum Analyzer: http://www.sillanumsoft.org/download.htm “Visual Analyzer” 25 But first – a critical note about ‘real’ strings (where ‘art’ can’t be avoided)

• strings have ‘stiffness’ • bass strings are wound to reduce this, but not all the way to their ends • treble strings are very short and ‘stiff’ • thus harmonics are not true multiples of

Piano Tuning fundamentals – their frequencies are increased by 1+n2 • concert grands have less because they have longer strings

26 n Tuning the ‘A’ keys: Ideal strings f0  440(2 );n  42

32 f 0 With 0.0001 inharmonicity

33.6 f sounds ‘sharp’0 sounds ‘flat’ Piano Tuning

Need to “Stretch” the tuning.

Can not match all harmonics, must compromise  ‘art’ 27 (how I’ve done it)

for octaves 0-2 tune to the harmonics in octave 3

for octaves 6-7

Piano Tuning set ‘R’ inharmonicity to ~0.0003 and use R(L) ‘Stretched’ .

28 but some keys don’t work…

were designed to come apart

(if you break a string tuning it, you’ll need to remove the ‘’ anyway)

Piano Tuning (remember to number the keys before removing them and mark which keys hit which strings)

“Regulation” Fixing keys, and making mechanical adjustments so they work optimally, and ‘feel’ uniform. 29 Piano Tuning

a pain on

30 Piano Tuning

31 “Voicing” the hammers

NOT for the novice

Piano Tuning (you can easily ruin a set of hammers)

32 Let’s now do it for real…

pin turning unisons (‘true’ or not?) tune using FFT Piano Tuning put it back together

33