フィルターのクリア

Audiowrite clipping warning issue..

10 ビュー (過去 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 Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by