Re: Anyone know of any pitch recognition DSP libraries ?
Re: Anyone know of any pitch recognition DSP libraries ?
- Subject: Re: Anyone know of any pitch recognition DSP libraries ?
- From: Ian Ollmann <email@hidden>
- Date: Mon, 26 Nov 2007 13:20:05 -0800
On Nov 26, 2007, at 12:06 PM, email@hidden
wrote:
2) For a given frequency value f in Hz, the closest corresponding
MIDI note can be calculated via:
m = round( log2((f / 8.1757989156)^12 ) )
If m is of integer type, lround might be more appropriate before.
I'm assuming this ^12 is exponentiation. You might also be able to
simplify things a bit here :
log2( x^12) = 12 * log2(x)
so..
m = lround( 12.0 * log2( f / 8.1757989156) )
...seems like it would be less likely to overflow spuriously for f >
~13300 (single precision), and we don't have to call pow().
You can also save a divide:
const float c = log2( 8.1757989156 );
m = lround( 12.0 * (log2( f ) - c )
Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden