Using mp3write

조회 수: 2 (최근 30일)
David Koenig
David Koenig 2012년 4월 9일
I have used mp3write with success often in the past but lately I am getting "clipping" errors.
Here is a typical session:
>> mp3write(y,Fs,16,'BuiltUpWave',1);
Warning: Data clipped during write to file:temp.wav
> In wavwrite>PCM_Quantize at 287
In wavwrite>write_wavedat at 309
In wavwrite at 138
In mp3write at 53
Can't init outfile 'c:\matlab6p1\apps\musicalsoundanalysis\matfilesmusicwaves\BuiltUpWave.mp3'
where
c:\matlab6p1\apps\musicalsoundanalysis\matfilesmusicwaves
happens to be the current folder and the variables involved are:
>> whos y Fs
Name Size Bytes Class Attributes
Fs 1x1 8 double
y 1x33075 264600 double
Can anyone show me what I am doing wrong? Thanks.
  댓글 수: 2
Image Analyst
Image Analyst 2012년 4월 9일
I don't have mp3write so I can't try anything. What toolbox is it in, or where did you get it?
Daniel Shub
Daniel Shub 2012년 4월 9일
mp3write comes from http://www.mathworks.com/matlabcentral/fileexchange/13852-mp3read-and-mp3write

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel Shub
Daniel Shub 2012년 4월 9일
The warning comes from the standard MATLAB function wavwrite. Given some other questions on Answers, I think wavwrite may have changed its behavior recently (although I haven't checked). Basically, a vector that has a +1 value will be clipped (by a single quantization unit). My guess is that mp3write is scaling things to be +/-1 and that this causes the clipping warning.
As a work around on line 53 (according to your error message) should be a line like
wavwrite(x, ...);
you can replace this with.
wavwrite(0.99*x, ...);
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 4월 9일
I haven't checked the older documentation, but the documentation of the current wavwrite() range limits is the same as my memory of the limits. It could be that before it did not warn about +1 exactly though.
Daniel Shub
Daniel Shub 2012년 4월 23일
Looking at this question again, it appears David uses MATLAB 6.1, so it is not a recent change in wavwrite.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by