diff functions/getNumBinsPerSemitoneFromFreqVec.m @ 0:b4e26b53072f tip

Initial commit.
author Holger Kirchhoff <holger.kirchhoff@eecs.qmul.ac.uk>
date Tue, 04 Dec 2012 13:57:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/functions/getNumBinsPerSemitoneFromFreqVec.m	Tue Dec 04 13:57:15 2012 +0000
@@ -0,0 +1,9 @@
+function numBinsPerSemitone = getNumBinsPerSemitoneFromFreqVec(freqsInHz)
+% numBinsPerSemitone = getNumBinsPerSemitoneFromFreqVec(freqsInHz)
+%
+% infers the number of bins per semitone from a given constant-Q frequency
+% vector in Hz
+
+ratios = freqsInHz(2:end) ./ freqsInHz(1:end-1);
+avgRatio =  mean(ratios);
+numBinsPerSemitone = round( 1/(12*log2(avgRatio)) );
\ No newline at end of file