A model of a biquadratic NIR filter.¶
The Biquad Filter block independently filters each channel of the input signal using the specified biquadratic filter with infinite impulse response (IIR). If you specify filter coefficients in the parameter settings window, the block implements static filters with fixed coefficients.
The recorded noisy audio signal is fed to the input of this filter, and at the output we get the filtered signal.
Let's proceed to the implementation of this project: set auxiliary functions and build a model.
Let's define the function of the player.
Pkg.add("WAV")
using WAV;
using .EngeeDSP;
function audioplayer(patch, Samples_per_audio_channel);
s, fs = wavread(patch);
buf = IOBuffer();
wavwrite(s, buf; Fs=fs);
data = base64encode(unsafe_string(pointer(buf.data), buf.size));
display("text/html", """<audio controls="controls" {autoplay}>
<source src="data:audio/wav;base64,$data" type="audio/wav" />
Your browser does not support the audio element.
</audio>""");
return s
end
Let's connect the auxiliary function of the model start.
function run_model( name_model)
Path = (@__DIR__) * "/" * name_model * ".engee"
if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
model = engee.open( name_model ) # Открыть модель
model_output = engee.run( model, verbose=true ); # Запустить модель
else
model = engee.load( Path, force=true ) # Загрузить модель
model_output = engee.run( model, verbose=true ); # Запустить модель
engee.close( name_model, force=true ); # Закрыть модель
end
sleep(5)
return model_output
end
Build and run the models.
Single channel model:
Multi-channel model:
run_model("Biquad_filter") # Запуск модели.
run_model("Biquad_filter_multichannel") # Запуск модели.
After running the model, we can see which frequencies have been filtered in the single-channel and multi-channel variations of the model.
Now let's listen to the input and output signals.
audioplayer("$(@__DIR__)/MysterySig.wav", 256);
audioplayer("$(@__DIR__)/output.wav", 256);
audioplayer("$(@__DIR__)/output_multichannel.wav", 256);
Conclusion¶
As we can hear and see, the filter works correctly and allows to get rid of extraneous noise in the source audio signal.