function 'sosfilter_double_mimo' not found in library
GwGuillaume opened this issue · 9 comments
Hi,
I am trying to use the pyfilterbank library under Ubuntu. When I try to run the example script
from pyfilterbank import octbank
octbank.example_plot()
I get the error "AttributeError: sosfilter_double_mimo: "function 'sosfilter_double_mimo' not found in library '/usr/local/lib/python2.7/dist-packages/pyfilterbank-0.0.0-py2.7.egg/pyfilterbank/sosfilt.so': /usr/local/lib/python2.7/dist-packages/pyfilterbank-0.0.0-py2.7.egg/pyfilterbank/sosfilt.so: undefined symbol: sosfilter_double_mimo".
Can anyone help me to fix the problem?
Best regards,
G.
Hi G.,
you should compile the sosfilt.c for your system first.
The next version should be a wheel but i do not have any time at the moment...
Best regards,
S.G.
Hi SiggiGue,
Thank you very much! Indeed, I have succeeded in compiling the sosfilt.c in the terminal with the command:
gcc -shared -fPIC sosfilt.c -std=c99 -o sosfilt.so
Now, the script now runs perfectly!
Best regards,
G.
Hi Siegfried,
I am trying to use pyfilterbank in order to get A-weighted sound
pressure levels per third octave bands (from fc=16 Hz until 20kHz). I
have tested the code with a white noise as input (wav file with a
sampling frequency fs=44.1 kHz downloaded here :
http://www.wavtones.com/functiongenerator.php) for which I expect to get
a constant A-weighted SPL for all frequency bands. Here some pieces of
my script:
sigA = pyfilterbank.splweighting.weight_signal(sig, sample_rate=fs,
weighting='A')
ofb = pyfilterbank.FractionalOctaveFilterbank(sample_rate=fs,
order=4, nth_oct=3.0, norm_freq=1000., start_band=-18, end_band=13,
edge_correction_percent=0.01, filterfun='cffi')
y, states = ofb.filter(sigA, ffilt=True)
spl = 20 * np.log10(np.sum(np.abs(y),axis=0))
Did you perform such tests? I wonder what exactly the parameter
norm_freq corresponds to? Could you give me some advices please?
Best regards,
G.
Le 06/05/2015 15:41, Siegfried Gündert a écrit :
Hi G.,
you should compile the sosfilt.c for your system first.
The next version should be a wheel but i do not have any time at the
moment...Best regards,
S.G.—
Reply to this email directly or view it on GitHub
#2 (comment).
Hi Guillaume,
You can use the numpy.random module to generate white noise.
The modules are tested on its own and due to the fact that all Filters used are linear Systems there is no Need to test such Combinations. In your sample code you weight the Signal, filter it by the filter Bank and then you sum up the absolute values of each Band, to get an a weighted Spektrum -- is that your Intention? You use ffilt=True so you get Bands filtred effektivere by 8th Order Butterworth third octave bandpasses.
To your Question: the parameter norm_freq is the cneter frequency from the band number 0. Because of this the start band is -18 or so i.e. 18 third octaves below norm frequency and the end. band is n bands above norm freq.
If you don't need the weighted time signal you could save som computational costs by just adding the third octave dampings for A weighting to the computed third octave levels. you can find these numbers in many technical acoustics books or in the corresponding standards.
best regard, siegfried
ipads auto completion sucks.... sorry for the typos
Hi Siegfried,
Thank you for the details. Unfortunately, generating white noise through
both the audio file and numpy.random module does not lead to the
expected third octave spectrum. I will carry on my verifications.
Best regards,
G.
Le 13/05/2015 18:22, Siegfried Gündert a écrit :
Hi Guillaume,
You can use the numpy.rondom module to generate white noise.
The modules are Testes on its own and due to the fact that all Filters
used are linear Systems there is no Need to test such Combinations. In
your samplerate Code you weight the Signal, filter it by the filter
Bank and then you sum up the absolute blaues of each Band, Tomate an a
weichten Spektrum -- is that your Intention? You use ffilt=True so you
get Bands filtred effektivere by 8th Order Butterworth third octave
bandpasses.To your Question: the parameter norm_freq is the cneter frequency from
the band number 0. Because of this the start band is -18 or so i.e. 18
third octaves below norm frequency and the end. band is n bands above
norm freq.If you don't need the weighted time signal you could save som
computational costs by just adding the third octave dampings for A
weighting to the computed third octave levels. you can find these
numbers in many technical acoustics books or in the corresponding
standards.best regard, siegfried
—
Reply to this email directly or view it on GitHub
#2 (comment).
What is the Problem with the output? What kind of spectrum would you expect? Actually the spectrum level should be proportional to f since the filters are constant relative bandwidth...
Can you show me the desired an actual result?
Am 19.05.2015 14:50 schrieb "GwGuillaume" notifications@github.com:
Hi Siegfried,
Thank you for the details. Unfortunately, generating white noise through
both the audio file and numpy.random module does not lead to the
expected third octave spectrum. I will carry on my verifications.Best regards,
G.
Le 13/05/2015 18:22, Siegfried Gündert a écrit :
Hi Guillaume,
You can use the numpy.rondom module to generate white noise.
The modules are Testes on its own and due to the fact that all Filters
used are linear Systems there is no Need to test such Combinations. In
your samplerate Code you weight the Signal, filter it by the filter
Bank and then you sum up the absolute blaues of each Band, Tomate an a
weichten Spektrum -- is that your Intention? You use ffilt=True so you
get Bands filtred effektivere by 8th Order Butterworth third octave
bandpasses.To your Question: the parameter norm_freq is the cneter frequency from
the band number 0. Because of this the start band is -18 or so i.e. 18
third octaves below norm frequency and the end. band is n bands above
norm freq.If you don't need the weighted time signal you could save som
computational costs by just adding the third octave dampings for A
weighting to the computed third octave levels. you can find these
numbers in many technical acoustics books or in the corresponding
standards.best regard, siegfried
—
Reply to this email directly or view it on GitHub
<
https://github.com/SiggiGue/pyfilterbank/issues/2#issuecomment-101734758>.—
Reply to this email directly or view it on GitHub
#2 (comment)
.
Hi Siegfried,
Sorry for the delay! I am trying to validate the third octave band
filtering with standard noises (as pink and white noises). Now, I obtain
satisfying results (I have attached two files that present the sound
pressure levels per third octave bands for both noises).
Nevertheless, I have a few questions.
-
It seems that the duration of the input signal is of importance. Have
you any recommendation concerning this parameter? As I would like to get
equivalent SPL per third octave bands over time periods equal to 125ms
and 1s, maybe it would better to filter a sample of the signal over a
longer duration (i.e. 5 or 10s), and then to compute the Leq(T=125ms)
and Leq(T=1s) from the filtered samples? -
For each third octave band filter, the filter coefficients that I
obtain are 4 arrays, each one corresponding to the sos coefficients [b0,
b1, b2, a0, a1, a2]. The order nth_oct in the function
FractionalOctaveFilterbank is then the number of cascade filters (as for
the Direct form 2 here:
http://en.wikipedia.org/wiki/Digital_biquad_filter). I try to understand
how the filter is applied on the input signal. If it is casade-filters,
the first set of coefficients [b0, b1, b2, a0, a1, a2] must be first
apply on x[n] by using the formula given in the previous web link that
results in y0[n], then the second set of coefficients are applied on
y0[n] and lead to y1[n], ..., until obtaining y3[n](as nth_oct=4) which
is the final filtered signal for the third octave band. Is it this
approach that is performed?
Here is the piece of code I use:
ofb = pyfilterbank.FractionalOctaveFilterbank(sample_rate=fs,
order=4, nth_oct=3.0, norm_freq=1000., start_band=-18, end_band=13,
edge_correction_percent=0.01, filterfun='cffi')
outputSig, states = ofb.filter(inputSig, ffilt=True)
Thank you for your consideration.
Kind regards,
G.
Le 19/05/2015 19:19, Siegfried Gündert a écrit :
What is the Problem with the output?
Can you show me the desired an actual result?
Am 19.05.2015 14:50 schrieb "GwGuillaume" notifications@github.com:Hi Siegfried,
Thank you for the details. Unfortunately, generating white noise through
both the audio file and numpy.random module does not lead to the
expected third octave spectrum. I will carry on my verifications.Best regards,
G.
Le 13/05/2015 18:22, Siegfried Gündert a écrit :
Hi Guillaume,
You can use the numpy.rondom module to generate white noise.
The modules are Testes on its own and due to the fact that all Filters
used are linear Systems there is no Need to test such Combinations. In
your samplerate Code you weight the Signal, filter it by the filter
Bank and then you sum up the absolute blaues of each Band, Tomate an a
weichten Spektrum -- is that your Intention? You use ffilt=True so you
get Bands filtred effektivere by 8th Order Butterworth third octave
bandpasses.To your Question: the parameter norm_freq is the cneter frequency from
the band number 0. Because of this the start band is -18 or so i.e. 18
third octaves below norm frequency and the end. band is n bands above
norm freq.If you don't need the weighted time signal you could save som
computational costs by just adding the third octave dampings for A
weighting to the computed third octave levels. you can find these
numbers in many technical acoustics books or in the corresponding
standards.best regard, siegfried
—
Reply to this email directly or view it on GitHub
<https://github.com/SiggiGue/pyfilterbank/issues/2#issuecomment-101734758>.
—
Reply to this email directly or view it on GitHub—
Reply to this email directly or view it on GitHub
#2 (comment).
-
- Use the filter states to improove transient behaviour.
- The impulse response length depends on the bandwidth... just to give you a hint.
-
yes. have a look at the file sosfilt.c in the repository. This implements the filter structure.
If you use ffilt=True the actual filterorder is twice of order
.
Best Regards, SG