tomwalters@0: % tomwalters@0: % function sig=gen_multidamp(carriers,halflifes,reprate,signal_length, sample_fq) tomwalters@0: % tomwalters@0: % Generates a superposition of damped sinusiod signals tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % carriers carrier frequences (vector) tomwalters@0: % halflifes (vector, same length as carriers) tomwalters@0: % reprate frequence of envelope tomwalters@0: % signal_length in seconds !!! tomwalters@0: % sample_fq sample frequence tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % sig object signal tomwalters@0: % tomwalters@0: % (c) 2003-2008, University of Cambridge, Medical Research Council tomwalters@0: % Christoph Lindner 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 tomwalters@0: tomwalters@0: function sig=gen_multidamp(carriers,halflifes,reprate,signal_length, sample_fq) tomwalters@0: tomwalters@0: if nargin < 5 tomwalters@0: sample_fq=16000; tomwalters@0: end tomwalters@0: if nargin < 4 tomwalters@0: signal_length=0.1; tomwalters@0: end tomwalters@0: if nargin < 3 tomwalters@0: reprate=100; tomwalters@0: end tomwalters@0: if nargin < 2 tomwalters@0: hlsteps=1; tomwalters@0: halflifes=distributelogarithmic(0.064,0.0005,hlsteps); tomwalters@0: halflifes=0.005; tomwalters@0: else tomwalters@0: hlsteps=length(halflifes); tomwalters@0: end tomwalters@0: if nargin < 1 tomwalters@0: carsteps=5; tomwalters@0: carriers=distributelogarithmic(250,4000,carsteps); tomwalters@0: else tomwalters@0: carsteps=length(carriers); tomwalters@0: end tomwalters@0: tomwalters@0: sr = sample_fq; tomwalters@0: % sr=2^14; tomwalters@0: % sr=16000; tomwalters@0: % signal_length=0.264-1/sr; tomwalters@0: sig=signal(signal_length,sr); tomwalters@0: tomwalters@0: for i=1:hlsteps tomwalters@0: for j=1:carsteps tomwalters@0: current_carrier=carriers(j); tomwalters@0: halflife=halflifes(i); tomwalters@0: sig=generatedampsinus(sig,current_carrier,reprate,1,halflife); tomwalters@0: tomwalters@0: if j==1 tomwalters@0: gsig=sig; tomwalters@0: else tomwalters@0: gsig=gsig+sig; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: if i==1 tomwalters@0: tsig=gsig; tomwalters@0: else tomwalters@0: tsig=append(tsig,gsig); tomwalters@0: end tomwalters@0: tomwalters@0: end tomwalters@0: % savewave(tsig,'tsig'); tomwalters@0: tomwalters@0: tomwalters@0: sig=tsig;