function y = synth_damp % y=synth_damp - Synthesize Patterson's "damp" stimulus. global sr; % sampling rate D = 0.1; % s - duration fc = 800; % Hz - carrier frequency fe = 40; % Hz - envelope frequency half = 4; % ms - half-life half = half / 1000; x = abscissa(D); % carrier y = sin(x * pi * 2 * fc); % envelope z = mod(x, 1/fe) / half; % sawtooth, 1 at half-life z = exp(z * log(0.5)); y = y .* z;