Wed Jan 23, 2013 8:27 pm
function voice();
% Part II: speech input
x= wavread('C:\Documents and Settings\pwd1.wav')
% plot the whole sequence
subplot(2,3,1);plot(x)
% Fs1 = 22050;
% plot the first 1000 samples of x
xx= wavread('C:\Documents and Settings\pwd1.wav',1000)
subplot(2,3,2);plot(xx)
% Part III: simple speech manipulation under MATLAB
%<play x>
wavplay(x,22050,'async')
%<play x at the half of sampling frequency>
wavplay(x,22050/2,'async')
%<play x at the doubled sampling frequency>
wavplay(x,22050*2,'async')
y=flipud(x)
wavplay(y,22050)
% apply a fine quantization to the speech signal
x1=round(x*100)*0.01
% the signal of quantization noise
subplot(2,3,3);plot(x1)
% plot the difference between x and x1
i=1:length(x);
subplot(2,3,4);plot(i,x,i,x-x1)
wavplay(x1,22050,'async')
x2=round(x*20)*0.05;
i=1:length(x);
% plot the difference between x and x2
subplot(2,3,5);plot(i,x,i,x-x2)
wavplay(x2,22050,'async')
% Part IV: speech output
% write vector x out as a wav file
wavwrite(x,'test.wav')
% write vector x out as an au file
auwrite(x,'test.au')
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.