I have written a code please help me in getting the output .
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Daniel Shub
am 11 Mai 2012
While unrelated to the warning you are getting, I am pretty sure
sound('Bird')
is not valid MATLAB syntax
Akzeptierte Antwort
Daniel Shub
am 11 Mai 2012
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 Kommentare
Weitere Antworten (1)
Geoff
am 11 Mai 2012
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 Kommentare
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!