フィルターのクリア

How to write audio without data clipping?

5 ビュー (過去 30 日間)
Su Latt Sandi
Su Latt Sandi 2018 年 2 月 15 日
コメント済み: Pham Xuan Trung 2020 年 7 月 9 日
Hello,
I want to write audio without data clipping. I tried by multiplying audio coefficients with float number (e.g. 0.1, 0.5, 0.001, etc.) to get the value within the range of -1 to +1. But this error are still occurred Warning: Data clipped when writing file. In audiowrite>clipInputData In audiowrite . I would be grateful if someone help me in this error.

採用された回答

Star Strider
Star Strider 2018 年 2 月 15 日
Try this to normalise the signals before you write them:
t = 0:99; % Time Vector (For Plotting)
V1 = randi([-9 9], 100, 1); % Create Out-Of-Range Data
V2 = V1 / max(abs(V1)); % Normalise To ±1
figure(1)
plot(t, V1, t, V2)
hold on
plot(xlim, [1 1], '--k')
plot(xlim, [-1 -1], '--k')
hold off
grid
legend('Original', 'Normalised', '±1')
The code simply divides all the data by the maximum of the absolute value (so it is not necessary to test both the positive and negative values). The plot illustrates the input and output of the normalisation.
Experiment to get the result you want.
  3 件のコメント
Star Strider
Star Strider 2018 年 2 月 16 日
My pleasure.
If my Answer helps you solve your problem, please Accept it!
Pham Xuan Trung
Pham Xuan Trung 2020 年 7 月 9 日
It works perfectly. You are amazing!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by