modfile = 'Sound/modulator22.wav'; carfile = 'Sound/white.wav'; outfile = 'Sound/vocodedsound.wav'; [modul, sr1] = audioread(modfile); [carrier, sr2] = audioread(carfile); if sr1 ~= sr2 disp('Sampling rates dont match'); end y = chanvocoder(carrier, modul, 512, 16, 0.2); audiowrite(outfile, y, sr1); % Plot temporal variations of modulator, carrier, and output signals t_mod = (0:length(modul)-1) / sr1; t_car = (0:length(carrier)-1) / sr1; t_out = (0:length(y)-1) / sr1; figure; subplot(3,1,1); plot(t_mod, modul); title('Modulator Signal'); xlabel('Time (s)'); ylabel('Amplitude'); subplot(3,1,2); plot(t_car, carrier); title('Carrier Signal'); xlabel('Time (s)'); ylabel('Amplitude'); subplot(3,1,3); plot(t_out, y); title('Output Signal'); xlabel('Time (s)'); ylabel('Amplitude'); % Compute spectrogram of modulator, carrier, and output signals spectrogram(modul, sr1, 5, 30); spectrogram(carrier, sr1, 5, 30); spectrogram(y, sr1, 5, 30);