Decimal places for frequency in spectrums?

Anything you think is missing, or needs enhancement, goes here.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by ElliotElliot » Tue Dec 12, 2017 7:10 pm

My guess was that the second A was flat. I think the analyzer showed this, but as we were saying it's probably just error and they are all the same. The analysis also had the last A being sharp, but the same applies.

For another example the difference between an E2 and an F2 is less than 5hz, so I would have thought that one or two hz would matter here. But my real application is to see if a backing track is slightly sharp/flat . If my guitar were also off in the other direction then I wonder if the effect would be quite significant.
ElliotElliot
 
Posts: 8
Joined: Tue Dec 12, 2017 9:40 am
Operating System: Windows 10

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by steve » Tue Dec 12, 2017 7:27 pm

Have you tried the "Pitch Detect" plug-in?
http://wiki.audacityteam.org/wiki/Nyqui ... tch_Detect
(Download / install instructions: http://wiki.audacityteam.org/wiki/Downl ... s#download)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46551
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by steve » Tue Dec 12, 2017 8:17 pm

ElliotElliot wrote:For another example the difference between an E2 and an F2 is less than 5hz

Yes, but the "Size" for FFT refers to the size of the analysis window in samples. At 44100 Hz sample rate, the maximum Size of 65536 samples is nearly 1 ½ seconds, so unless the musical tempo is very slow, the spectrum will be that of several notes. Yes you could increase the sample rate, but that increases the range of the spectrum, which makes the ranges of the "bins" wider (the number of bins is half the "Size", and the bins collectively cover the range from 0 Hz (DC offset) to half the sample rate (the "Nyquist" frequency).

Also, even down to C0, if you get a result that is correct to the nearest 1 Hz, you will get the right note.
(The lowest note of a double bass is usually E1, and most of the sound that you hear is higher harmonics of that).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46551
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by ElliotElliot » Wed Dec 13, 2017 8:57 am

That's a good point about the note having to be long enough to analyze accurately.

When you say "to the nearest hz" though....hmmm, I would have thought the accuracy is +/-0.5 hz then. And the difference between C0 and c#0 is only 1.0 hz.

In any case, thanks for the discussion. I'm interested in trying to write my own plugin later on.
ElliotElliot
 
Posts: 8
Joined: Tue Dec 12, 2017 9:40 am
Operating System: Windows 10

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by ElliotElliot » Wed Dec 13, 2017 2:18 pm

kozikowski wrote:
I think one or two hz can be quite significant.

Why do you think that?

What instruments do you play? My joke is that I don’t play the piano, I play at the piano. Big difference.

Koz


Guitar. For the low E, bending the note by a couple of hz is easy to hear.

And the errors could add up. An interval can of course be off by up to twice the error. This adds to any other errors, for example because we a using equal temperament.
ElliotElliot
 
Posts: 8
Joined: Tue Dec 12, 2017 9:40 am
Operating System: Windows 10

Re: Decimal places for frequency in spectrums?

Permanent link to this post Posted by steve » Wed Dec 13, 2017 3:02 pm

Worth noting that with real-world sounds, there are always harmonics present. Although the frequency resolution of FFT gets progressively worse at lower frequencies, for many sounds it can be expected that the first harmonic will be exactly double the frequency of the fundamental. In terms of "pitch", a more accurate estimate may be made by looking at the harmonics.

window-Frequency Analysis-000.png
Guitar Low E
window-Frequency Analysis-000.png (43.73 KiB) Viewed 227 times


Example, in this spectrum the fundamental shows 83 Hz. Given the "Size" of 8192 samples and a sample rate of 44100 Hz, that figure lies between 80.749512 Hz and 86.132812 Hz, and the interpolated estimate is 83 Hz Here is the relevant part of the data (exported from Plot Spectrum):
Code: Select all
64.599609   -50.531769
69.982910   -46.574673
75.366211   -32.057095
80.749512   -22.215677
86.132812   -24.367990
91.516113   -40.745335
96.899414   -50.853859


Looking at the first harmonic, the interpolated estimate is 164 Hz. Here is the data:
Code: Select all
139.965820   -50.730862
145.349121   -48.354359
150.732422   -44.920811
156.115723   -34.589748
161.499023   -19.850306
166.882324   -18.712814
172.265625   -29.874290
177.648926   -45.561481
183.032227   -50.346607


Taking a naive approximation that the true value is somewhere between the mid-points of the adjacent bins, at 83 Hz, a range of +/- 2.6 Hz represents +/- 39.6 cents, but for the first harmonic, the accuracy improves to +/- 27.9 cents. If I recall correctly, Plot Spectrum uses cubic interpolation, so the approximation will actually be much better than this, but the same principle applies, that the first harmonic value is likely to be a better approximation than the fundamental.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46551
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Previous

Return to Adding Features to Audacity



Who is online

Users browsing this forum: No registered users and 1 guest