aspen.sounds.filtered_noise

Filtered noise

Functions

filtered_noise([duration, btype, …])

Generate filtered noise.

Classes

FilteredNoise([filtered_noise_duration, …])

Generate filtered noise.

class aspen.sounds.filtered_noise.FilteredNoise(filtered_noise_duration=[1000], filtered_noise_btype=['bandpass'], filtered_noise_filter_freq=['800_1200'], filtered_noise_filter_impulse_response=['fir'], filtered_noise_filter_order=[512], filtered_noise_filter_firwin=['hann'], filtered_noise_num_signals=1, samp_freq=16000)[source]

Bases: aspen.interfaces.abs_common_interface.AbsCommonInterface, aspen.interfaces.abs_sound_interface.AbsSoundInterface

Generate filtered noise.

Parameters
  • filtered_noise_duration (Sequence[float]) – The duration of filtered noise in millisecond. Defaults to [1000].

  • filtered_noise_btype (Sequence[str]) – The type of filtering. The choices are lowpass, highpass, bandpass or bandstop. Defaults to [“bandpass”].

  • filtered_noise_filter_freq (Sequence[str]) – Cutoff frequency to filter a noise in Hz. In the case of bandpass or bandstop, specify the lower/upper freqencies splitted by the underscore symbol (e.g. 800_1200). Defaults to [“800_1200”].

  • filtered_noise_filter_impulse_response (Sequence[str]) – The type of impulse response for filtering noise. The choices are fir or iir that are a finite impulse response or infinite impulse response, respectively. Defaults to [“fir”].

  • filtered_noise_filter_order (Sequence[int]) – The number of the filter order. Defaults to [512].

  • filtered_noise_filter_firwin (Sequence[str]) – Type of FIR window. Window functions are listed in Scipy doc (https://docs.scipy.org/doc/scipy/reference/signal.windows.html). Defaults to [“hann”].

  • filtered_noise_num_signals (int) – Number of signals. If this value greater than 2, the other arguments should contain 2 types. Defaults to 1.

  • samp_freq (int) – Sampling frequency. Defaults to 16000.

__call__()

Generate a specified number of signals.

Return type

List[ndarray]

Returns

Generate signals.

Output well be sequence-like object such as list, tuple and so on.

_generate_each(idx)[source]

Generate each signal.

Parameters

idx (int) – Index of signal generation.

Return type

ndarray

Returns

Generate signal.

static add_arguments(parser)[source]

add arguments

classmethod load_class_kwargs(args)

Return the kwargs dict for class __init__ from parsed arguments

Parameters

args (Namespace) – (config)argparse arguments

Return type

dict

Returns

kwargs for class __init__

aspen.sounds.filtered_noise.filtered_noise(duration=[1000], btype=['bandpass'], filter_freq=['800_1200'], filter_impulse_response=['fir'], filter_order=[512], filter_firwin=['hann'], num_signals=1, samp_freq=16000)[source]

Generate filtered noise.

Parameters
  • duration (Sequence[float]) – The duration of filtered noise in millisecond. Defaults to [1000].

  • btype (Sequence[str]) – The type of filtering. The choices are lowpass, highpass, bandpass or bandstop. Defaults to [“bandpass”].

  • filter_freq (Sequence[str]) – Cutoff frequency to filter a noise in Hz. In the case of bandpass or bandstop, specify the lower/upper freqencies splitted by the underscore symbol (e.g. 800_1200). Defaults to [“800_1200”].

  • filter_impulse_response (Sequence[str]) – The type of impulse response for filtering noise. The choices are fir or iir that are a finite impulse response or infinite impulse response, respectively. Defaults to [“fir”].

  • filter_order (Sequence[int]) – The number of the filter order. Defaults to [512].

  • filter_firwin (Sequence[str]) – Type of FIR window. Window functions are listed in Scipy doc (https://docs.scipy.org/doc/scipy/reference/signal.windows.html). Defaults to [“hann”].

  • num_signals (int) – Number of signals. If this value greater than 2, the other arguments should contain 2 types. Defaults to 1.

  • samp_freq (int) – Sampling frequency. Defaults to 16000.

Return type

List[ndarray]

Returns

Output signals.