Unexpected output of octaveFilter

2 views (last 30 days)
Leonard
Leonard on 10 Aug 2022
Edited: jibrahim on 15 Aug 2022
Hey Guys,
I have a problem with the OcataveFilter or do not understand the specific output yet. Maybe you could help me.
So first I create an octaveFilter object.
centerFreq = 800;
bw = '1/3 octave';
Fs = 16000;
octFilt = octaveFilter(centerFreq,bw,'SampleRate',Fs);
My audio data is available as a vector (audio_data). I pass this vector to the system object. Here I keep to the appropriate documentation
filtered_audio_data = octfilt(audio_data);
Now I have presented the data here: I do not understand this behavior. Why is the course between filtered and undfiltered exactly identical ? My expected result is shown at the very bottom. What am I doing wrong in the calculation and what do I have to do to get the expected result ?
Thanks fpr your advice and help
Before Filtering (audio_data):
After Filtering (filtered_audio_data):
Expected Result:

Accepted Answer

jibrahim
jibrahim on 12 Aug 2022
Hi Leonard,
The first thing to check is that your input is a column vector. octaveFilter treats each column of data as an independent channel. Second, keep in mind the filter has memory, so there will be transient behavior. If you call the object with a short input, you might be still in the transient region. You need to either call it with more data, or call it more times with more data
  2 Comments
Leonard
Leonard on 15 Aug 2022
thank you very much for your answer. My column vector (audio_data) has 399361 values. Even after trying several times, there seems to be no change at all. However, if I perform the operation in SIMULINK, I get the expected result. This seems to me as not logical, because internally the same operation is performed, isn't it ?
Sound1_3OctaveFilt.slx:
%Start the SIMULINK-Model
out = sim("Sound1_3OctaveFilt.slx");
%Get data from SIMULINK-Model
filtered_audio_data = out.SoundFilt;
jibrahim
jibrahim on 15 Aug 2022
Edited: jibrahim on 15 Aug 2022
Hi Leonard,
Maybe this code helps if you compare with yours. Not sure what's the problem, but this snippet shows the same filter actually modifying a simple test signal:
centerFreq = 800;
bw = '1/3 octave';
Fs = 16000;
octFilt = octaveFilter(centerFreq,bw,'SampleRate',Fs);
octFilt.visualize % see the theoretical response
% Hopefully the filter will attenuate one sine and pass the other one:
osc = audioOscillator(NumTones=2, Frequency=[800 2000],SampleRate=Fs);
scope = timescope(SampleRate=Fs);
for index=1:100
x = osc();
y = octFilt(x);
scope([x,y]) % compare before and after
end

Sign in to comment.

More Answers (0)

Categories

Find more on Measurements and Spatial Audio in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!