Notch filtering
The Notch-Peak Filter unit filters each channel of the input signal by time, using a preset center frequency and bandwidth.
In our case, the following settings are used:
- 200 Hz bandwidth,
- The center frequency of the peak/cutout is 7350 Hz.
- The sampling frequency of the input signal is 22050 Hz.
The recorded noisy audio signal is fed to the input of this filter, and at the output we receive a filtered signal.
Let's move on to the implementation of this project: we will define auxiliary functions and build a model.
Let's define the player's function.
Pkg.add(["WAV"])
using WAV;
using .EngeeDSP;
function audioplayer(patch, fs, Samples_per_audio_channel);
s = vcat((EngeeDSP.step(load_audio(), patch, Samples_per_audio_channel))...);
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 launching the model.
function run_model( name_model)
Path = (@__DIR__) * "/" * name_model * ".engee"
if name_model in [m.name for m in engee.get_all_models()] # Checking the condition for loading a model into the kernel
model = engee.open( name_model ) # Open the model
model_output = engee.run( model, verbose=true ); # Launch the model
else
model = engee.load( Path, force=true ) # Upload a model
model_output = engee.run( model, verbose=true ); # Launch the model
engee.close( name_model, force=true ); # Close the model
end
sleep(5)
return model_output
end
Let's build and run the model.
run_model("NotchPeak_filter") # Launching the model.
After running the model, we can see which frequencies have been filtered.
Now let's listen to the input and output signals.
audioplayer("$(@__DIR__)/MysterySig.wav", 24000, 256);
audioplayer("$(@__DIR__)/output.wav", 24000, 256);
Conclusion
As we can hear from the recordings and see from the model, the filter works correctly and allows you to get rid of extraneous noise in the original audio signal.