Mercurial > hg > adaptinstrspec
annotate 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 |
rev | line source |
---|---|
holger@0 | 1 function numBinsPerSemitone = getNumBinsPerSemitoneFromFreqVec(freqsInHz) |
holger@0 | 2 % numBinsPerSemitone = getNumBinsPerSemitoneFromFreqVec(freqsInHz) |
holger@0 | 3 % |
holger@0 | 4 % infers the number of bins per semitone from a given constant-Q frequency |
holger@0 | 5 % vector in Hz |
holger@0 | 6 |
holger@0 | 7 ratios = freqsInHz(2:end) ./ freqsInHz(1:end-1); |
holger@0 | 8 avgRatio = mean(ratios); |
holger@0 | 9 numBinsPerSemitone = round( 1/(12*log2(avgRatio)) ); |