matlab - Generate ramp audio signal of frequencies within specific duration -
i wanted generate frequencies of 10hz 1000hz step of 10hz, let's within 5s (all frequencies equally distributed within time frame). how achieve individual frequency generator function below?
function [ ] = producefeq( frequency, duration, amplitude, freqsampling ) if ~exist('freqsampling', 'var'), freqsampling = 44100; end if ~exist('amplitude', 'var'), amplitude = 1; end if nargin <2, error('not enough input arguments'); end % frequency argument case above 10:10:1000 t = 0:(1/freqsampling):duration; y = amplitude*sin(2*pi*frequency*t); sound(y, freqsampling); end
thanks in advance!
you can call producefeq
multiple times , use pause
wait between multiple executions.
totalduration = 500; frequencies = 10:10:1000; duration = totalduration/length(frequencies); = 1:length(frequencies) producefeq( frequencies(i), duration) pause(duration) end
Comments
Post a Comment