I have written a code please help me in getting the output .
1 次查看(过去 30 天)
显示 更早的评论
When i run this code i got a warninig that data cliped during write to file. Please sugggest something.
clear;
clc;
[data,Fs]=wavread('bird');
predictor = [0 1]; %%y(k)=x(k-1)
M=2;
freq_sep= 100;
nsamp=6;
fs=1000;
snr=0:1:25;
for i=1:1:length(snr)
partition = [-1 1];
codebook = [-1 .50 1];
% Quantize x using DPCM.
encodedx = dpcmenco(data,codebook,partition,predictor); %%modulated signal
fsk_mod=fskmod(encodedx,M,freq_sep,nsamp,fs);
noise=awgn(fsk_mod,snr(i));
fsk_demod=fskdemod(noise,M,freq_sep,nsamp,fs);
decodedx = dpcmdeco(fsk_demod,codebook,predictor);
[num,rate(i)]=biterr(encodedx,fsk_demod);
wavwrite(decodedx,Fs,8,'Bird')
sound('Bird')
end
semilogy(snr,rate)
1 个评论
Daniel Shub
2012-5-11
While unrelated to the warning you are getting, I am pretty sure
sound('Bird')
is not valid MATLAB syntax
采纳的回答
Daniel Shub
2012-5-11
Wow, this question keeps coming up. The WAVWRITE function expects its input (in your case decodedx) to be an array with all values having a magnitude less than 1. You need to scale your decodedx.
See
0 个评论
更多回答(1 个)
Geoff
2012-5-11
Is the output wave supposed to be 8-bit? That's exceptionally grungey... I don't use these wave file functions, but I expect that 'clipped' refers to the signal peaks getting chopped off due to a sampling issue. It could be that your source is 16-bit.
If you type:
class(decodedx)
Does it say uint8?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!