having errors while converting .mat file to .wav file

x=load('read.mat');
>> f=fieldnames(x);
>> wavwrite(x.(f{1}),8000,'foo.wav')
Warning: Data clipped during write to file:foo.wav
> In wavwrite>PCM_Quantize at 247
In wavwrite>write_wavedat at 267
In wavwrite at 112
>>

 採用された回答

Daniel Shub
Daniel Shub 2012 年 5 月 10 日

0 投票

Instead of
wavwrite(x.(f{1}),8000,'foo.wav')
try
nBits = 16;
Y = x.(f{1});
Y = Y./max(abs(Y(:)))*(1-(2^-(nBits-1)));
wavwrite(Y,8000,nBits,'foo.wav')

その他の回答 (1 件)

Daniel Shub
Daniel Shub 2012 年 5 月 9 日

0 投票

The error means that at least for one sample either x<-1 or x>1.

6 件のコメント

tammna abid
tammna abid 2012 年 5 月 9 日
what u really meant by this ? what should i do ? i didnt get u
Daniel Shub
Daniel Shub 2012 年 5 月 9 日
See my edit
tammna abid
tammna abid 2012 年 5 月 9 日
hav seen this , tahnku man , but still getting errors with both methods mention there
tammna abid
tammna abid 2012 年 5 月 9 日
Sir, i have post my queries there , pls see them
Daniel Shub
Daniel Shub 2012 年 5 月 9 日
Thank you equals a vote. I wasn't suggesting you ask in that thread, but rather, that the answer was in the thread.
tammna abid
tammna abid 2012 年 5 月 11 日
Oh my falut , next time i wont do it ..Thanks !!!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by