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=getrandommelody(nr,from,to) tomwalters@0: tomwalters@0: if nargin < 3 tomwalters@0: to=1000; tomwalters@0: end tomwalters@0: if nargin < 2 tomwalters@0: from=100; 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 > from & notearray1 < to); tomwalters@0: notearray=notearray1(notearray2); tomwalters@0: tomwalters@0: fres=[]; tomwalters@0: for i=1:nr tomwalters@0: randnr=ceil(rand(1)*size(notearray,2)); tomwalters@0: note=notearray(randnr); tomwalters@0: fres(i)=note; tomwalters@0: end tomwalters@0: