Hello, I am working on a simulation of reading an audio signal into a 4-PAM modulator and demodulating in on the other side. I have Matlab and the Signal Processing toolbox that has the PAM modulator in it. I am having issues trying to format the data into the correct context to get the modulation to work. My current script is shown below:
fileIn = 'dog_dare2.wav';info = audioinfo(fileIn);nyRate = info.SampleRate*2;%extract the information
%set the sampling frequency to twice that of the file
%Extract the data and the sample rate
[origY,origFs] = audioread(fileIn);%Play the sound back
%sound(origY,origFs)
figureax1 = subplot(2,1,1);ax2 = subplot(2,1,2);%Plot the input signal and the digitized version
t1=[1/origFs:1/origFs:length(origY)/origFs];plot(ax1,t1,origY)%upsample the original date to nyquist rate
upY = upsample(y,2);t2=[1/nyRate:1/nyRate:length(upY)/nyRate];%add a plot
plot(ax2,t2,upY)
So I am analyzing the input signal for the sampling rate and then switching to the nyquist rate to double the sampling rate of the original. This is where I would think I would be able to put the information into the modulator but the modulator only accepts values from [0,M-1 (or 3 in this case)]. So I need to translate or scale the information into an acceptable input for the PAM modulator to work. Please help me out when you get a chance.
Best Answer