Answer the question
In order to leave comments, you need to log in
How are guitar tuners arranged?
Once upon a time, on WindowsMobile, I had a program that determined the frequency of the sound entering the microphone and displayed a note and an indication of "higher / lower" if the sound does not hit the note. You could use it to tune an acoustic guitar or just learn to sing. So how are these applications designed? How to determine the frequency of the sound on the microphone or LineIn?
Answer the question
In order to leave comments, you need to log in
Capturing audio from a microphone or lineIn is not particularly a problem, and then ... digital audio is a sequence of samples, the number of these samples is determined by the sampling rate. Each sample is a number describing the amplitude at a given time. The frequency of a sound can be determined by the distance between two identical peaks. Well, tobish as on a regular schedule.
Frequency analysis is applied (based on Fourier transform or Wavelet, etc.). Musical sound in the frequency domain is a collection of peaks. The first peak is at the lowest (base) frequency, and the rest are at multiples of it. In the simplest case, the algorithm is as follows:
1) We record a piece of the audio signal
2) We calculate the power spectral density (PSD) using the Walsh method (Welch) or others.
3) We are looking for the first peak on the PSD, we take its frequency.
4) We calculate the note number by the formula:
N = 12 * log2 (f / 440), where f is the frequency, in Hz, where the first peak is located,
the note number is obtained in semitones relative to the first octave (this note has a frequency of 440 Hz, hence the constant in the formula).
If N turns out to be close to the whole, then the tuning is done exactly on the note to which N corresponds. If the fractional part of N is greater than 0.1 or less than 0.9, then the tuning is inaccurate.
Searching for a peak using PSD is not a trivial task, because there are many local maxima due to noise, and the global maximum is not necessarily the first harmonic (it can be at a multiple of the base frequency). Therefore, it is possible, for example, to first find the global maximum, and then look for local maxima at frequencies close to fractional of the frequency of the global maximum, and at the same time having an amplitude, say, at least 1/2 of the amplitude of the global maximum.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question