필터 지우기
필터 지우기

I have written a code please help me in getting the output .

조회 수: 1 (최근 30일)
Mubasher
Mubasher 2012년 5월 11일
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
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
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

추가 답변 (1개)

Geoff
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?

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by