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 fres=getupdownmelody(nr,aroundfre,upordown) tomwalters@0: tomwalters@0: if nargin < 3 tomwalters@0: upordown='down'; tomwalters@0: end tomwalters@0: if nargin < 2 tomwalters@0: aroundfre='A4'; tomwalters@0: end tomwalters@0: if nargin < 1 tomwalters@0: nr=5; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % notearray1=note2fre(1:83); tomwalters@0: % notearray2=find(notearray1 > aroundfre & notearray1 < to); tomwalters@0: % notearray=notearray1(notearray2); tomwalters@0: tomwalters@0: fres=[]; tomwalters@0: df=power(2,1/12); tomwalters@0: if strfind(upordown,'up') tomwalters@0: fre1=note2fre(aroundfre); tomwalters@0: fre2=fre1*power(df,2); tomwalters@0: else tomwalters@0: fre1=note2fre(aroundfre); tomwalters@0: fre2=fre1/power(df,2); tomwalters@0: end tomwalters@0: tomwalters@0: for i=1:nr tomwalters@0: if mod(i,2) tomwalters@0: fres(i)=fre1; tomwalters@0: else tomwalters@0: fres(i)=fre2; tomwalters@0: end tomwalters@0: end tomwalters@0: