I have written a code please help me in getting the output .
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Daniel Shub
il 11 Mag 2012
While unrelated to the warning you are getting, I am pretty sure
sound('Bird')
is not valid MATLAB syntax
Risposta accettata
Daniel Shub
il 11 Mag 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 Commenti
Più risposte (1)
Geoff
il 11 Mag 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 Commenti
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!