tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function [cent,oct,relcent]=getmusicaltone(fre) tomwalters@0: % usage: [cent,oct]=getmusicaltone(fre) tomwalters@0: % gives back the cent of this tone and in which octave above 27.5 Hz it is tomwalters@0: % and the relative cent above the last octave - redundant, but useful tomwalters@0: tomwalters@0: min_fre=27.5; % the frequency, that defines the smallest frequency (A2) tomwalters@0: tomwalters@0: oct=floor(log2(fre/min_fre)); tomwalters@0: tomwalters@0: % one octave is 1200 cent: tomwalters@0: % f= f_min*power(2,oct)*power(2,cent/1200) tomwalters@0: tomwalters@0: cent=1200*log2(fre/min_fre); tomwalters@0: tomwalters@0: relcent=cent-oct*1200;