I want to create some custom filters in Matlab
filterDesigner tool and then apply those filters to a large set of audio files. I want to use python to do the application of the filters to the audios.
I created a Butterworth filter in Matlab and exported it as an ASCII file. In there I get two datas. SOS Matrix and Scale Values. Then I read the file in python and got the SOS matrix and filtered my signal using the result as follows (using
from scipy import signal x_sos = signal.sosfilt(sos, x) # x is my signal
The result I get has the desired shape except for the amplitude being different (I applied the same filter in Matlab and compared the output from the python code). I understand that scale values needs to come into this equation. But how do I incorporate that? I don't understand this answer. This question has answers explaining the scale values but still I have no idea how I should use that in the python code
EDIT: (After getting the answer) To anyone who is interested in the final code, here it is. And there's an explanation again in this thread
from scipy import signal import numpy as np x_sos = signal.sosfilt(sos, x) * np.prod(scale) # x is my signal