having errors while converting .mat file to .wav file

2 vues (au cours des 30 derniers jours)
tammna abid
tammna abid le 9 Mai 2012
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
>>

Réponse acceptée

Daniel Shub
Daniel Shub le 10 Mai 2012
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')

Plus de réponses (1)

Daniel Shub
Daniel Shub le 9 Mai 2012
The error means that at least for one sample either x<-1 or x>1.
  6 commentaires
Daniel Shub
Daniel Shub le 9 Mai 2012
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 le 11 Mai 2012
Oh my falut , next time i wont do it ..Thanks !!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by