Audiowrite clipping warning issue..

조회 수: 9 (최근 30일)
Edmund Paul Malinowski
Edmund Paul Malinowski 2015년 11월 24일
답변: Walter Roberson 2015년 11월 25일
Hey all,
Part of my program is creating a melody of various sine waves and this all works as it should. It also saves the melody as a wav using audiowrite. When it saves, in the command line, i get orange warnings saying the signal clipped a bit.
Here's part of my code for the melody creation:
% CREATE A LOW PASS FILTER TO AVOID CLICKS IN THE FULL MELODY..
LPfiltX=designfilt('lowpassfir', 'PassbandFrequency', 1000, 'StopbandFrequency', 1100, 'PassbandRipple', 1, 'StopbandAttenuation', 60, 'SampleRate', Fs);
% FOR: LOOP THROUGH THE 7 USER CHOSEN NOTES..
for i = 1:7;
tX = 0:1/Fs:1; % TIME..
f = out(i); % FREQUENCY..
SineZ{i} = sin(2*pi*f*tX); % CREATE SINE WAVE..
end
% END FOR..
% CONCATENATE SINEZ ARRAY INTO ONE VARIABLE..
Wave = cell2mat(SineZ); % CONCATENATE VECTORS..
t_p = linspace(0, length(Wave), length(Wave)); % CREATE MATCHING TIME VECTOR..
% FILTER THE MELODY WITH THE LP FILTER..
MyOPfiltCREATE=filter(LPfiltX,Wave);
Here's the orange warning text:
Warning: Data clipped when writing file.
> In audiowrite>clipInputData (line 396)
In audiowrite (line 176)
In EPM_gui_form>btSAVEWAV_Callback (line 269)
In gui_mainfcn (line 95)
In EPM_gui_form (line 33)
In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)EPM_gui_form('btSAVEWAV_Callback',hObject,eventdata,guidata(hObject))
Is there any way to stop it clipping. Can i assign a maximum amplitude to the melody (signal) or apply a filter or something at the creation stage to keep the signals below a certain level?
Any ideas?
Thanks,
Paul..

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 25일
The valid range for the data in y depends on the data type of y.
double -1.0 ≤ y ≤ +1.0
If you data is out of that range you should divide it by max( abs(YourData(:)) )

카테고리

Help CenterFile Exchange에서 Statistics and Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by