フィルターのクリア

Writing a wav file using Matlab

2 ビュー (過去 30 日間)
Micaela
Micaela 2012 年 10 月 11 日
コメント済み: Shlomit 2014 年 12 月 15 日
I have a question: I have created some audio files using Matlab, with a sampling frequency of 10000 Hz, and when I try to use the function wavwrite in order to generate the corresponding wav files, I have this warning:
"Data clipped during write to file..."
I know that this problem is generated by the amplitude of the signals, because it must be normalized to 1, and I have tried to use this line of code:
signal = signal/max(abs(signal));
but the problem isn't solved. Can anyone tell me how can I solve this problem? Thanks a lot.

採用された回答

Wayne King
Wayne King 2012 年 10 月 11 日
編集済み: Wayne King 2012 年 10 月 11 日
If you are using
wavwrite(Y,FS,WAVEFILE)
then the acceptable range for the data, Y, is -1.0 <= Y < +1.0
so I'm assuming that you have values in your output equal to 1, which is resulting in the clipping. One thing you can do is to use 32 bits to write the file. That has output format implications -- see the help for wavwrite
wavwrite(Y,FS,32,WAVEFILE)
or you can add a small deltaA to your scaling factor that would avoid you getting a 1.
deltaA = 0.1;
signal = signal./(max(abs(signal))+deltaA);
  3 件のコメント
Micaela
Micaela 2012 年 10 月 12 日
Ok, I have solved the problem with this line of code (supposing that I write the file with 24 bits) :
signal = signal./max(abs(signal(:)))*(1-(2^-(24-1)));
Thank you of all:)
Shlomit
Shlomit 2014 年 12 月 15 日
This helped a lot, Thank you Micaela!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by