[y, fs] = wavread('C:\Users\Habad\Dropbox\SPRING 2012 CLASSES\EEGR491\myvoice.wav');
%w = [min(fs) max(fs)]
%sound(y,fs);
%plot(y);
%stem(y);
t=0:1/fs:(length(y)-1)/fs; %get sampling frequency
figure(1);
plot(t,y); %graph it – try zooming while its up…not much visible until you do
FIG 1: AUDIO SIGNAL PLOT WITHOUT NOISE
%clear
[y,fs] = wavread('C:\Users\Habad\Dropbox\SPRING 2012 CLASSES\EEGR491\myvoice_nonoise.wav');
%w = [min(fs) max(fs)]
%sound(y,fs);
%plot(y);
%stem(y);
t=0:1/fs:(length(y)-1)/fs; %get sampling frequency
figure(2);
plot(t,y); %graph it – try zooming while its up…not much visible until you do
FIG 2: AUDIO SIGNAL PLOT WITH NOISE
COMMENTS
So far, I have been able to input my voice as a .wav audio signal. I then sampled it. For the quantization which is step 2, I started writing a function but I decided to write a C code with similar algorithm that would perform the same operation. The program would take in a string of discrete values and then assigned each one of the discrete values to a level. This was taken as a step to enable me understand exactly how the quantization would take place.
C CODE (Incomplete)
int main()
{
int quant[8] = {0,1,2,3}; //levels
int y, yq, i;
y = [2,3,4,5,6,8,1,2,4,5,2,4,5,6,0,3,4,-1,4,5,1,2,10,9]; //input signal
for (i = 0; i <0; i++)
{
//B = 4, number of levels
//so break max and min into 4 different levels/ranges
//how many numbers are between max and min, then divide that number by number of levels i.e. 4
//min=-1, max = 10, so number of numbers = 12, so there would be 4 elements per range
yq = quant[i]; //quantized
}
system("pause");
return 0;
}


No comments:
Post a Comment