Experiment: Audio Amplitude
The experiment "Audio Amplitude" measures the amplitude of audio recorded from the microphone. A history of the peak amplitude and the RMS (root-mean-square) of the audio signal are shown.
There are no 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.
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.
The experiment looks at 50ms recordings at a time to calculate an amplitude. For each of these short samples the peak amplitude is simply the largest value in the recorded data. For the RMS, each sample is squared, then all samples are added up. The square root of this sum is taken and then divided by the number of samples in this 50ms snipped.
Problems and resolutions
- Short bursts of noise (for example a clap) are missed. This may happen if your device is too slow to analyse the audio as fast as it is recorded. You might be able to work around this problem by creating your own version of the experiment and remove the RMS analysis. Only calculating the peak amplitde, but not the RMS should be significantly faster.