40 lines
817 B
Matlab
40 lines
817 B
Matlab
[y,Fs] = audioread("modulator22.wav");
|
|
#y = y(1.95*Fs:2.05*Fs)
|
|
% n between 1 an d 1.1
|
|
% u between 1.45 and 1.6
|
|
% i between 1.95 and 2.05
|
|
|
|
t = (0:length(y)-1)/Fs;
|
|
%[pwr, dur] = frequencySpectrum(y, Fs, 0);
|
|
%xlabel("Timee (s)");
|
|
%ylabel("Amplitude");
|
|
#spectrogram(y,Fs,5,5);
|
|
|
|
Factor_of_reduction = 2;
|
|
y_down = downsample(y,Factor_of_reduction);
|
|
y_decimate = decimate(y,Factor_of_reduction);
|
|
audiowrite("modulator_new.wav", y_down, Fs/Factor_of_reduction);
|
|
|
|
%plot (t,y,'b')
|
|
%hold on
|
|
%t2 = (0:length(y_down)-1)/(Fs/Factor_of_reduction);
|
|
%plot (t2,y_down,'r')
|
|
%t3 = (0:length(y_decimate)-1)/(Fs/Factor_of_reduction);
|
|
|
|
%plot (t3,y_decimate,'g');
|
|
Fc = 1000;
|
|
|
|
[b] = fir1 (30,2*Fc/Fs);
|
|
y_b = filter(b,1,y);
|
|
|
|
[a,c] = butter(8,2*Fc/Fs);
|
|
y_ac = filter(a,c,y);
|
|
|
|
plot (t,y_b);
|
|
hold on;
|
|
plot (t,y_ac,'r');
|
|
|
|
freqz(a,c);
|
|
freqz(b,1);
|
|
|