deutsch     english    français     Print

 

4.5 ACOUSTIC EXPERIMENTS

 

 

INTRODUCTION

 

You can also use the computer in place of an experimental system, for example you could investigate human hearing using the sound system. This is not only cheaper, but it also gives you a huge amount of flexibility, especially when you perform the experiments with a self-written program.

PROGRAMMING CONCEPTS: Concert pitch, beating, scale

 

 

TUNING A MUSICAL INSTRUMENT, BEATING

 

The hearing cannot distinguish two tones with almost the same frequencies when they are played separately. However, if they are played simultaneously this results in a rise and fall in volume which is very well audible. In order to experience this yourself, make your program play a standard concert pitch A (440 Hz) for 5 seconds and later for the same period an only 1 Hz higher pitch. There is no noticeable difference. When playing both tones at together you can clearly hear the beating phenomenon.

import time

playTone(440, 5000)
time.sleep(2)
playTone(441, 5000)
time.sleep(2)
playTone(440, 20000, block = False)
playTone(441, 20000)
Highlight program code (Ctrl+C copy, Ctrl+V paste)

 

 

MEMO

 

The global function playTone() has different parameter variations that you can read about in the TigerJython Help file under APLU Documentation (coordinate graphic). Here you use the parameter block, with which you can define whether the function blocks until the tone is done being played, or whether it returns immediately after starting to play. You have to use the non-blocking variant to play multiple sounds simultaneously.

To tune instruments in an orchestra, but also to tune a single instrument (string instrument, piano, etc.), two notes are played at the same time while paying attention to the beating.

 

 

SCALES

 

The well-tempered musical scale is based on a standard concert pitch with the frequency 440 Hz and divides the octave (frequency ratio 2) in 12 semitones with the same frequency ratio r. Thus gives:

You can easily play the C major scale with this, which according to the notation, consists of whole and half steps. The concert pitch corresponds to the note a.

In the just or natural scale the tone frequencies are formed by multiplication with simple ratios starting from the root tone. The ratios for the 8 tones of an octave are:

or as a series of numbers, they are: 24, 27, 30, 32, 36, 40, 45, 48. To play these, you can save the frequencies in a list and call playTone(). Once you have played both scales individually, you can listen to the two differently tuned instruments playing the scale together. As you will notice, it sounds really bad.

r = 2**(1/12)
a = 440

scale_temp = [a / r**9, a / r**7, a / r**5, a / r**4, a / r**2,
              a, a * r**2, a * r**3]
scale_pure = [3/5 * a, 3/5 * a * 9/8, 3/5 * a * 5/4,  3/5 * a * 4/3,  3/5 * a * 3/2,
              a, 3/5 * a * 15/8, 3/5 * a * 2]

playTone(scale_temp, 1000)
playTone(scale_pure, 1000)

playTone(scale_temp, 1000, block = False)
playTone(scale_pure, 1000)
Highlight program code (Ctrl+C copy, Ctrl+V paste)

 

 

MEMO

 

In the well-tempered scale, neighboring semitones always have the same frequency ratio (so, not equal frequency differences!). The advantage of the well-tempered scale over just intonation is that the frequency ratios are always the same for all keys (C major, D major, etc.). [more... Chords in just intonation sound but "pure" because there are no beats of the overtones.]

 

 

PLAYING MELODIES

 

You can also play a simple melody for fun using playTone(). For subsequent tones of equal length, use tuples with a pitch and speed indication, and put them into a list. Finally, it is also possible to choose a musical instrument. In this example you probably recognize a children's tune. Which one is it?

v = 250
playTone([("cdef", v), ("gg", 2*v), ("aaaa", v//2), ("g", 2*v),
          ("aaaa", v//2), ("g", 2*v), ("ffff", v), ("ee", 2*v),
          ("dddd", v), ("c", 2*v)], instrument="harp")
Highlight program code (Ctrl+C copy, Ctrl+V paste)

 

 

MEMO

 

It is really amazing how easily you can play a melody using playTone(). However, compared to a real musical instrument, it sounds very synthetic.

 

 

EXERCISES

 

1.


You can write down a song as a list of tone frequencies and then play it with a for loop:

melody = [262, 444, 349, 349, 392, 330, 262, 466, 440, 392, 392, 349]
v = 200
for f in melody:
    playTone(f, v)

a. Do you know this song? Play it back a bit slower.

b. Play the song one octave higher.

c. For your singing class, the first version is too low and the second is too high. Transpose the melody so that it starts with g' instead of c'.

2.


Play the chord c'', e'', g'' (third, fifth) for twenty seconds with the well-tempered intonation. (For this, you can use playTone() giving it letters for the tones.) Now play the same chord, but with just intonation. What do you notice?