A digital telephone converts an analog signal(our voice) to a digital signal before transmission. While the analog signal takes on real number values, the digital signal takes on only a finite set of integer values. We can model these implementation effects and save memory by storing the digital as an integer data type rather than as type double. I did this by writing the script in the following. When I run I got the pics showing the script is nicely working in the below of the script..
% Load sampled (discretized time) analog sources
% with double values between -1 and +1.
load phonecalls
% See and hear both sources together.
% Note source clipping at -1 and +1.
plot(source1,'r')
hold on
plot(source2,'b')
ylabel('DOUBLE Values')
title('{\bf Analog Sources}')
legend('Source 1','Source 2')
soundsc([source1,source2],Fs) % Stereo
pause(4)
%% ====== Source coding (quantization) ======
% Digital signals (discretized values) with scaled
% and quantized int8 values between -128 and 127.
sig1 = int8(128*source1);
sig2 = int8(128*source2);
% See and hear both signals together.
% Clipped values at -1 and +1 in the sources
% saturate in the signals at -128 and 127.
figure
plot(sig1,'r.')
hold on
plot(sig2,'b.')
ylabel('INT8 Values')
title('{\bf Digital Signals}')
legend('Signal 1','Signal 2')
soundsc([double(sig1),double(sig2)],Fs) % Stereo
------
As you see from the script I plotted the analog sources and the digital signals seperately. The
plot are shown in Figures. Any other necessary explanations is in the comments in the
script.
I want to speak about some functions and commands these are we used in the script above.
load: load workspace variables from disk.
No comments:
Post a Comment