data clipped warning while coding.

1 回表示 (過去 30 日間)
maulik bhagat
maulik bhagat 2022 年 9 月 3 日
コメント済み: maulik bhagat 2022 年 9 月 15 日
i am trying to run the code but error is popping up that data clipped when writing file
code:
load handel.mat
t=-4:1/22100:4;
f=40000;
fs=20000;
y1=sin(2*pi*f*t);
y2=sin(2*pi*fs*t);
y=y1+y2;
samples = [1,5*Fs];% for 5 second
filename = 'handel.wav';
audiowrite(filename,y,fs);
[y,Fs] = audioread('handel.wav',samples);
sound(y,Fs);

回答 (1 件)

Mathieu NOE
Mathieu NOE 2022 年 9 月 5 日
hello
FYI, wav export will clip data exceeding +/- 1 range
so you have to normalize the data (y) before writting to wav format
y=y1+y2;
y = y./max(abs(y));
  2 件のコメント
Mathieu NOE
Mathieu NOE 2022 年 9 月 12 日
hello again
problem solved ?
maulik bhagat
maulik bhagat 2022 年 9 月 15 日
solved thank you.

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

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by