Steps
1. First record object and do sound recording for 5 sec or can be recorded more then 5 sec.
2. save the recorded sound in .wav format using wavewrite.
3. Read the saved.wav sound using wave read command.
4. Now construct a carrier using this equation A*cos(2*pi*f*t)
5. Where A=Amplitude f=Sampling frequency and t=time.
6. Then use linspace command to generate time where t=linspace (a,b,n) generates t row vector of n point linearly between a and b.
7. Then modulate multiplying carrier with data and then play sound to listen modulated data.
8. After modulation demodulation will be the same way and play the sound to listen the sound.
9. Then at last graph will plot.
2. save the recorded sound in .wav format using wavewrite.
3. Read the saved.wav sound using wave read command.
4. Now construct a carrier using this equation A*cos(2*pi*f*t)
5. Where A=Amplitude f=Sampling frequency and t=time.
6. Then use linspace command to generate time where t=linspace (a,b,n) generates t row vector of n point linearly between a and b.
7. Then modulate multiplying carrier with data and then play sound to listen modulated data.
8. After modulation demodulation will be the same way and play the sound to listen the sound.
9. Then at last graph will plot.
MATLAB Code
clear
clc
close all
duration=10;
recObj = audiorecorder;
fprintf('Press any key to start %g seconds of recording… \n', duration); pause
fprintf('\n Recording…');
recordblocking(recObj, 10);
fprintf('\n Finished recording. \n');
file=recObj;
myRecording = getaudiodata(recObj);
fprintf('\n Press any Key to listen to Recording %h.', myRecording); pause
fprintf('\n Playing… \n');
play(recObj); pause
waveFile='Project.wav';
fprintf('\n Press any key to save the sound data to %s…', waveFile); pause
wavwrite(myRecording,'project.wav');
fprintf('\n Saved.. \n');
[y, fs, nbits]=wavread('project.wav'); % find out sampling rate,
N=length(y);
Ac=2;
fc=15e5;
t=linspace(0,length(y)/fs,length(y));
Carrier=Ac*cos(2*pi*fc*t);
carrier=transpose(Carrier);
modulatedvoice=carrier.*y;
demodulatedvoice=carrier.*modulatedvoice;
disp(' Press any Key to Listen to Modulated Voice'); pause
sound(modulatedvoice);
disp('Press any Key to Listen to Demodulated Voice'); pause
sound(demodulatedvoice);
fprintf('\n Press any Key to Display the Signals. \n'); pause
subplot(4,1,1)
plot(t,myRecording);
xlabel('Time'); ylabel('signal');
title('Original');
subplot(4,1,2)
plot(t,carrier)
xlabel('Time'); ylabel('signal');
title('carrier');
subplot(4,1,3)
plot(t,modulatedvoice)
xlabel('Time'); ylabel('signal');
title('modulated voice');
subplot(4,1,4)
plot(t,demodulatedvoice)
xlabel('Time'); ylabel('signal');
title('demodulated voice');
clc
close all
duration=10;
recObj = audiorecorder;
fprintf('Press any key to start %g seconds of recording… \n', duration); pause
fprintf('\n Recording…');
recordblocking(recObj, 10);
fprintf('\n Finished recording. \n');
file=recObj;
myRecording = getaudiodata(recObj);
fprintf('\n Press any Key to listen to Recording %h.', myRecording); pause
fprintf('\n Playing… \n');
play(recObj); pause
waveFile='Project.wav';
fprintf('\n Press any key to save the sound data to %s…', waveFile); pause
wavwrite(myRecording,'project.wav');
fprintf('\n Saved.. \n');
[y, fs, nbits]=wavread('project.wav'); % find out sampling rate,
N=length(y);
Ac=2;
fc=15e5;
t=linspace(0,length(y)/fs,length(y));
Carrier=Ac*cos(2*pi*fc*t);
carrier=transpose(Carrier);
modulatedvoice=carrier.*y;
demodulatedvoice=carrier.*modulatedvoice;
disp(' Press any Key to Listen to Modulated Voice'); pause
sound(modulatedvoice);
disp('Press any Key to Listen to Demodulated Voice'); pause
sound(demodulatedvoice);
fprintf('\n Press any Key to Display the Signals. \n'); pause
subplot(4,1,1)
plot(t,myRecording);
xlabel('Time'); ylabel('signal');
title('Original');
subplot(4,1,2)
plot(t,carrier)
xlabel('Time'); ylabel('signal');
title('carrier');
subplot(4,1,3)
plot(t,modulatedvoice)
xlabel('Time'); ylabel('signal');
title('modulated voice');
subplot(4,1,4)
plot(t,demodulatedvoice)
xlabel('Time'); ylabel('signal');
title('demodulated voice');