Skip to content

Filter center frequency condition not met #69

@Antoine101

Description

@Antoine101

Hi,

I am trying to calculate Sharpness on 200ms temporal blocks of a signal sampled at 25600Hz.
I get the following error:

File ~\Anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File d:\dev\alarm_new\identification\machine learning\postprocess_dataset.py:31
    dataset_sliced = load_slice_compute(

  File d:\dev\ml_tools\ml_tools\audio\machine_learning\load_slice_compute.py:113 in load_slice_compute
    feature_vector.compute(snapshot_norm, sampling_rate, filter_signal, Wn, btype, cepstrum_formula)

  File d:\dev\ml_tools\ml_tools\audio\machine_learning\features.py:58 in compute
    self._computation()

  File d:\dev\ml_tools\ml_tools\audio\machine_learning\features.py:146 in _computation
    result = eval(feature["function"])(self.signals[domain]["y"], function_args)

  File d:\dev\ml_tools\ml_tools\audio\machine_learning\features_functions.py:1088 in sharpness
    sharpness = sharpness_din_st(signal, args_dict["fs"], weighting="din")

  File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\sharpness\sharpness_din\sharpness_din_st.py:33 in sharpness_din_st
    N, N_specific, _ = loudness_zwst(signal, fs, field_type=field_type)

  File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\loudness\loudness_zwst\loudness_zwst.py:68 in loudness_zwst
    spec_third, _ = noct_spectrum(signal, fs, fmin=24, fmax=12600)

  File ~\Anaconda3\lib\site-packages\mosqito\sound_level_meter\noct_spectrum\noct_spectrum.py:63 in noct_spectrum
    spec.append(_n_oct_time_filter(sig, fs, fc, alpha))

  File ~\Anaconda3\lib\site-packages\mosqito\sound_level_meter\noct_spectrum\_n_oct_time_filter.py:43 in _n_oct_time_filter
    raise ValueError(

ValueError: ERROR: Design not possible. Filter center frequency shall
            verify: fc <= 0.88 * (fs / 2)

Probing noct_spectrum function with print statements, I see that the last value of fc_vec is 12589.25411794, which doesn't meet the criteria.

Why is that? Are there some requirements on the sampling rate of the signal I pass to the sharpness function? I can't found anything of the sort in the doc.

Thanks in advance!

Antoine

EDIT: After further investigation I understood that it tries to take into account all third octave bands, hence the error in my case where the sampling rate and thus max frequency is too low.
Would it be possible to calculate the metrics by omitting some bands? Perhaps it could still be a valuable acoustic indicator/feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions