aspen.stimuli.noise_vocoded_speech

Noise-vocoded speech

Classes

NoiseVocodedSpeech([samp_freq, …])

Generate nosie-vocoded speech.

class aspen.stimuli.noise_vocoded_speech.NoiseVocodedSpeech(samp_freq=16000, num_freqband=4, freqband_scale_method='octave', user_freqband='0_600_1500_2100_4000', freqband_limit='500_8000', erb_band_number_limit='3_35', erb_band_number_step=1, filter_impulse_response_method='fir', filter_order=512, filter_fir_window='hann', ext_env_method='rect', ext_env_impulse_response_method='fir', ext_env_filter_order=512, ext_env_fir_window='hann', ext_env_freq=16)[source]

Bases: aspen.interfaces.abs_common_interface.AbsCommonInterface, aspen.interfaces.abs_stimulus_interface.AbsStimulusInterface

Generate nosie-vocoded speech.

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

  • num_freqband (int) – Number of frequency band. Defaults to 4.

  • freqband_scale_method (str) – Scale of frequency band. The choices are octave, erb and user. Defaults to “octave”.

  • user_freqband (str) – User defiened frequency band scale. Use only when freqband_scale_method is user. Defaults to “0_600_1500_2100_4000”.

  • freqband_limit (str) – Lower & upper frequency of bandpass. Use only when freqband_scale_method is octave or erb. Defaults to “500_8000”.

  • erb_band_number_limit (str) – Lower & upper bandlimit number in ERB scale. Use only when freqband_scale_method is erb. Defaults to “3_35”.

  • erb_band_number_step (int) – Step number in ERB scale to reduce the ERB. Use only when freqband_scale_method erb. Defaults to 1.

  • filter_impulse_response_method (str) – Type of impulse response for filtering. Defaults to “fir”.

  • filter_order (int) – Number of the filter order. Defaults to 512.

  • filter_fir_window (str) – Type of FIR window for filtering. Window function is listed in Scipy doc (https://docs.scipy.org/doc/scipy/reference/signal.windows.html). Defaults to “hann”.

  • ext_env_method (str) – Method of envelope extraction. hilbert is (hilbert transform + low-pass filter). rect is (half-wave rectification + low-pass filter). Defaults to “rect”.

  • ext_env_impulse_response_method (str) – Type of impulse response for extracting envelope. Defaults to “fir”.

  • ext_env_filter_order (int) – Number of the filter order for extracting envelope. Defaults to 512.

  • ext_env_fir_window (str) – Type of FIR window for extracting envelope. Window function is listed in Scipy doc (https://docs.scipy.org/doc/scipy/reference/signal.windows.html).”, Defaults to “hann”.

  • ext_env_freq (float) – Frequency of the lowpass filter for extracting envelope. Defaults to 16.

__call__(x)[source]

Generate noise-vocoded speech.

Parameters

x (Sequence[ndarray]) – Speech signal and noise signal. x must be sequence-like object such as list, tuple and so on. The first element is speech signal and the second one is noise (i.e. [speech, noise]). The duration of noise must be equal to or greater than the one of speech signal. In the case of gap_method=silent, the second element is ignored.

Return type

ndarray

Returns

Noise-vocoded speech.

_configure_frequency_band()[source]

Generate frequency band configuration

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__