Nothing escapes.
Harmony and Melody
.
The tuning of classic music instrumentation by means of objective measurement of pitches
 

Nederlandstalige versie.

Version Française.
.

Home J. Broekaert.
.

.Appendix 2:

.

Pitch measurement techniques.....(content)

This text is a translation.
Your comments are welcome.

1    Application of existing instrumentation.....(content)

Normal electronics frequency meters
In general problems are encountered when applying normal electronics frequency meters.
Because of the complexity of the acoustic waves and the short period of time available to perform the measurement, it usually is not possible to measure the pitches with sufficient precision if using normal electronic frequency meters.

Commercially available musical tuning instrumentation, and PC programs
As stated already in the main text paragraph 2.3, the application of said instruments is limited to simple sound.

2    Possibilities for further developments.....(content)

 It is often difficult to do precise pitch measurement of acoustic waves, because of the complex structure of the sounds
  • several zero crossings of the signal can take place over one single period of the signal: see for example the red line in figure 2 further on in this text.
  • sounds with differing harmonic structure (see also paragraph 2.3 of the main text) it is not sufficient to measure the pitch of the fundamental wave, but some way or another the frequencies of the (differing) harmonics have to influence the result
Commercially available tuning instruments avoid a number of problems by having an internal oscillator that is tracked to equal frequency of the note that is tuned by means of some type of Phase Locked Loop (PLL). Instead of measuring the pitch directly on the acoustic wave one can hear, one measures the pitch of the very simple waveform of the internal oscillator that is locked to the pitch of the sound because of the PLL. The PLL is normally concipiated around a switching demodulator controlled by a square wave, and therefore has some sensitivity for odd harmonics of the signal. This technique can also be subject to problems: the stability of the PLL can be lost in case of complex signals.
Personal experiments were made with a PLL detector consisting of a saw-tooth wave combined with an analog multiplier, instead of the classic circuit consisting of a square wave signal with a switching demodulator. Although a saw-tooth wave fundamentally includes ALL possible harmonics, even AND odd, no significant stability improvement was noticed by using this more sofisticated PLL detector.

However, said experiments have helped in gaining the insight that autocorrelation techniques could be of very great help in measuring pitches of complex acoustic signals: autocorrelation involves ALL the harmonic components of a signal and application of autocorrelation techniques allows for search of maximum correspondence between the original sound signal and same signal after delay. Maximal correspondence occurs after the first period of the complex signal.
The autocorrelation function is calculated using the following formula:

  Formula 1
It is not possible to implement the above formula and to search for the maxims of the function by using classic analogue electronic circuits.
Implementation of autocorrelation techniques is possible by storing the signal in memory, followed by proper signal processing: digital signal processing is very appropriate here. Today autocorrelation techniques are possible by simple use of a PC with sound-card and appropriate software (SW).
The herewith proposed autocorrelation technique has been simulated on a spreadsheet by implementing the herewith described processing:
Simulation with a spreadsheet
  • Generation of a complex signal:

  • The spreadsheet generates a complex signal by calculating the sum of several sine waves with different amplitudes, frequencies and phases, over a large number of samples in time, over more than two periods of the fundamental sine wave
      • Chosen model of the complex wave is the wave one can obtain by exciting a string at 1/7-th of its length. 7-th harmonics are usually not wanted in music, because of harmony, and this can among other techniques be obtained by excitation of strings at 1/7-th of its length.
      • The harmonic content of the complex wave is limited by using a gaussic low pass filter
      • The herewith obtained relative amplitudes of the harmonics are given in figure 1
        •  
            Figure 1
      • The model signal one obtains with the above calculated sum, when no phase-shifts have taken place between the several harmonics is displayed in figure 2 by the blue line. The red signal always is a displays of the sound wave obtained after "degeneration" (= phase shifts have taken place between the harmonics) of the signal.
  • Calculation of the autocorrelation function:

  • The integral of the autocorrelation function is simulated by calculating the sum of the discrete products, according to the herewith given formula (but with lesser samples than given in this formula).
       Formula 2 This calculation is executed:
  • By calculating the sum on the signal in combination with itself (n = 0)
  • By consecutive calculation of the sum on the signal in combination with a stepwise growing delay in time of itself (n = 1 tot 3999)
  • The series of product-sums obtained, is a set of samples of the autocorrelation function. The autocorrelations are exhibited by the green and the yellow signal in figure 2
  • Determination of the pitch:

  • The amplitude of the first sample is measured in the above obtained series of samples is used as a reference value, and according to autocorrelation theory this sample always is a maximum. Next step is to search for the next point that has the same value as the first sample or that comes very close to it. The distance between this two defined points is a very good measure for the pitch of the signal. This algorithm has not been implemented in the spreadsheet, but visual evaluation of the distance between the maxima of the autocorrelation functions is easy on figure 2
Random changes of phases of the harmonics will result only in significant change the waveform of the complex acoustic wave, as exhibited by the red line in figure 2. The autocorrelation exhibits almost no change, and as can be seen it always exhibits a sharp and high maximum under all circumstances, sufficient for reliable determination of the pitch (see green and yellow line). The fact that the autocorrelation of the random signal can differ slightly to the autocorrelation of the signal with all phases equalling zero (see blue line), has to do with errors introduced due to the limited number of samples taken. This simulation is using 120 samples only per period, over two periods. In reality one should use at very least 2000 samples or more in order to meet the required precision of at least a semi (musical) comma.

    Figure 2
 
Colors
Signals 
  Acoustic signal with all harmonics in phase at the origin
  Acoustic signal with random phases of the harmonics
  Autocorrelation of the blue acoustic signal
  Autocorrelation of the red acoustic signal (is basically equal to the green signal)

It is possible to experiment with this simulation by clicking the hyperlink below, for download and installation of the spreadsheet developed for the simulation:

Excel Spreadsheet with simulation of autocorrelation of complex sound waves (about 400KB, Office 95 is required)
Note :
This spreadsheet contains a macro. This macro is safe: it allocates to the drawn button the function to recalculate the data of the spreadsheet, as can be verified by reviewing the macro via [Tools] [macro] [macros...] [edit].
It is possible to use the spreadsheet without the macro, but in this case the drawn button will not be active.
Whenever function key F9 is hit after installation of the file, new waves will be calculated. The waves will always all have the same harmonic content, but the phases of the harmonics will differ at random. At same time as the waves the autocorrelation functions are recalculated.
The effect of recalculation is always limited to a relevant change of the red line and only very limited changes in the yellow line.
The systematic recurrence of the same autocorrelation functions, with clear maxima, signifies nothing more than a confirmation of existing autocorrelation theories. Therefore this file brings nothing more but practical and positive evidence that application of autocorrelation techniques makes sense for achieving the aim described in this text, whereby pitch determination should be possible also for very complex waveforms.

I have not yet been able to find comeercially available autocorrelation software capable of high precision measurement of complex sounds out of professional environment.
Also share-ware or free-ware versions have not yet been found.

Some articles describe the application of autocorrelation functions for identification of musicals records.

3    Practical implementation of autocorrelation techniques.....(content)

Practical implementation of autocorrelation techniques should imply the SW development that supports following algorithm:

   Formula 3.....conlusions


Content

The tuning of classic music instrumentation by means of objective pitch measurement

1    Introduction..
2    Pitches
    2.1    General
    2.2    The measurement of musical pitches
    2.3    Instrumentation
3    Conclusions


Appendix 1:    Properties of musical temperaments..
    1    Elementary musical properties
        1.1    The Pythagoric temperament
        1.2    The natural (pure) temperament
        1.3    The equal temperament
        1.4    The meantone temperament
        1.5    Selected temperaments
        1.6    Well temperament
        1.7    To probe further
    2    Musico-technical analysis
        2.1    Basic data
        2.2    Characteristics of a number of intervals: overview
        2.3    Characteristics of a number of intervals: circle of fifths
        2.4    Characteristics of intervals: Graphic comparison

Appendix 2:    Pitch measurement techniques..
    1    Application of existing instrumentation
    2    Possibilities for further developments
    3    Practical implementation of autocorrelation techniques

Revision 2003-07-26