Experiment: Audio Autocorrelation
The experiment "Audio Autocorrelation" determines the frequency and period of a single frequency audio signal (for example a single note from a guitar - not a chord) from the microphone. While it is limited to single frequency audio, it is usually more precise in contrast to the Audio Spectrum experiment, which on the other hand can handle multiple frequencies at once.
A less obvious use for this experiment is measuring the RPM of fast rotating device like a turbo pump, a centrifuge or a turbine. The noise from these devices is dominated by the frequency at which the device rotates. Unfortunately, this frequency has to be in the range typically used by speech (200Hz - 5000Hz). The microphone in a phone is optimized for this frequency range and will have difficulties to pick up lower frequencies (for example from the motor of a car). You might have more success with an external mic or the Acceleration Spectrum experiment.
There are no hardware requirements. The microphone is used to measure any sound. However, depending on your requirements you might want to attach an external microphone to your device.
Also, there are some limitations to the type of audio signal that gives reasonable results. As this experiment uses an autocorrelation to calculate the frequency, it can not distinguish multiple frequency at the same time. This means, that for example a chord will give no meaningfull result. Similarly, background noise can have a rather strong impact on the reliability of the measured frequency.
There is no specific setup. Depending on what audio source you want to measure, you might want to aim the microphone at the sound source and try to damp the sound from the environment.
This experiment records 100ms blocks of audio and calculates the autocorrelation of the data. This gives a mathematical description of how much the data "resembles itself" (if you are interested in this, please go ahead and research "autocorrelation") as a function of a shift of the data on its time axis. Typically, the autocorrelation data has a maximum at a shift of zero as of course the data resembles itself perfectly (it is obviously an exact match). The next maximum will be found if the data is shifted by the periodicity of the original signal, because now each period of the signal has to be matched to the next period, which will work quite well for a periodical signal. In-between these maxima, the autocorrelation is lower (usually negative).
phyphox finds the last maximum in the calculated period and counts the number of maxima up to this point. The position of the last maximum divided by the number of maxima is the period we are looking for. Note that phyphox determines maxima as exceeding half of the maximum amplitude of the autocorrelation.
Problems and resolutions
- The frequency is unreliable or entirely wrong. Make sure that the audio signal mostly consists of a single frequency. If there is a lot of background noise or other frequencies, this method does not give a reasonable result. You might want to try the Audio Spectrum experiment instead.