I really having a hard time to tackle the following question. It is asked to load a ".mat" file using load file.mat. And the result is two variables: Fs varaible contains the sampling frequency=44100, y is a 441344x1 matrix that contains data points of this audio.

It is asked to amplitude modulate this audio by multiplying a cosine function of frequency 4 Hz. This is to micmic the tremolo effect. This corresponds to y.*cos(2*pi*4.*n)

But my question is, how should I define the length of n? If I do


The resulting audio sounds very weird. Then, how should I define n then?


Your modulation signal must be

$$m(n)=\cos(2\pi f/f_sn)$$

where $f=4\;Hz$, $f_s=44100\;Hz$ is the sampling frequency, and $n$ is the integer sample index. In Matlab this looks like

L = 441344;
n = (0:L-1);
f = 4/44100;        % normalized frequency
m = cos(2*pi*f*n);
ym = y(:).*m(:);    % modulated signal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.