I’m trying to make an app in visual C++ that gets the microphone input (or line-in) and then tries to find what note you are hearing..
for example: i plug my guitar into the soundcard, hit a note and the computer tells me it is an F..
I know i have to do this with fourier transformations.
I was wondering.. could I do this with the fmod built-in equalizer functions?
I’m also looking for people who want to help me with writing this program.. i have a pretty good knowledge of C++ but not of maths (fourier)..
- nathanb asked 15 years ago
you have not to wonder about the FFT:
To use the FSOUND_DSP_GetSpectrum()-Method, you have to FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit, TRUE), what do you think stands “FFTUnit” for? 😉
I think the FSOUND_DSP_GetSpectrum()-Method is not exactly enough for your application:
A 44100Hz audio has a Nyquist frequency of 22050Hz. The Nyquist freqency is the highest frequency a 44100Hz-audio can reproduce.
The FSOUND_DSP_GetSpectrum()-Method returns an array of 512 floats. These floats describe the intensity of a part of the whole bandwidth(0-22050Hz):
Value 00: 000.0-043.1
Value 01: 043.1-086.1
Value 02: 086.1-129.2
Value 03: 129.2-172.3
Value 04: 172.3-215.3
Value 05: 215.3-258.4
Value 06: 258.4-301.5
Value 07: 301.5-344.5
Value 08: 344.5-387.6
Value 09: 387.6-430.7
Value 10: 430.7-473.7
Value 11: 473.7-516.8
Value 12: 516.8-559.9
Well now, here the frequency of a few standardnotes:
Note | Frequency [Hz] | Band
C’ | 264 | 06
Cis’ | 275 | 06
D’ | 297 | 06
Es’ | 317 | 07
E’ | 330 | 07
F’ | 352 | 08
Fis’ | 367 | 08
G’ | 396 | 09
As’ | 422 | 09
A’ | 440 | 10
B’ | 475 | 11
H’ | 495 | 11
C” | 528 | 12
You see the problem: Often there are more than one note in one bandwidth!
If you play only one note at a moment, you could try to do some math to find out which note it is, for example:
Fis’ is ~ in the middle of bandwidth 08, F’ is at the beginning of bandwidth 08, this means playing an F’ sets a higher value for bandwidth 07 than playing an Fis’.
(If I’d try to solve your problem (with the FSOUND_DSP_GetSpectrum()), I’d love to do this with a neuronal network, this would be very easy, and could maybe even handle more than one note at a point of time )
Well, I think, now you see your two solutions:
1) You try to make your own calculations with FFT
2) You try to find out a way to determine the note with FSOUND_DSP_GetSpectrum()
PS: sorry for the rude language, I wrote the whole message already once, but then my ç%!&$ IE crashed!
- Lenherr answered 15 years ago
Please login first to submit.