boblsturm@0: function octs = hz2octs(freq, A440) boblsturm@0: % octs = hz2octs(freq, A440) boblsturm@0: % Convert a frequency in Hz into a real number counting boblsturm@0: % the octaves above A0. So hz2octs(440) = 4.0 boblsturm@0: % Optional A440 specifies the Hz to be treated as middle A (default 440). boblsturm@0: % 2006-06-29 dpwe@ee.columbia.edu for fft2chromamx boblsturm@0: boblsturm@0: if nargin < 2; A440 = 440; end boblsturm@0: boblsturm@0: % A4 = A440 = 440 Hz, so A0 = 440/16 Hz boblsturm@0: octs = log(freq./(A440/16))./log(2); boblsturm@0: