aspen.sounds.complex_tone

Complex tone

Functions

complex_tone([duration, fundamental_freq, …])

Generate complex tone.

Classes

ComplexTone([complex_tone_duration, …])

Generate complex tone.

class aspen.sounds.complex_tone.ComplexTone(complex_tone_duration=[1000], complex_tone_fundamental_freq=[440], complex_tone_num_harmonics=[10], complex_tone_first_harmonic_freq=[440], complex_tone_harmonics_amp=['1'], complex_tone_tilt_type=['default'], complex_tone_num_signals=1, samp_freq=16000)[source]

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

Generate complex tone.

Parameters
  • complex_tone_duration (Sequence[float]) – The duration of complex tone in millisecond. Defaults to [1000].

  • complex_tone_fundamental_freq (Sequence[float]) – The fundamental frequency of complex tone in Hz. This value determines the interval of each frequency peak. Defaults to [440].

  • complex_tone_num_harmonics (Sequence[int]) – The number of harmonics. Defaults to [10].

  • complex_tone_first_harmonic_freq (Sequence[float]) – The frequency of first harmonics. When this value is not same value as –complex-tone-fundamental-freq or a multiple of –complex-tone-fundamental-freq, the output signal becomes inharmonic. Defaults to [440].

  • complex_tone_harmonics_amp (Sequence[str]) – Relative amplitude of each harmonics. The format is like 2_1_1_1 which is meant that the first harmonics has twice as much amplitude as the other three harmonics. Defaults to [“1”] which generates the same amplitude signal for all harmonics.

  • complex_tone_tilt_type (Sequence[str]) – Type of spectral tilt. up, down means 6, -6 dB/Oct, respectively. default will do nothing.

  • complex_tone_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.complex_tone.complex_tone(duration=[1000], fundamental_freq=[440], num_harmonics=[10], first_harmonic_freq=[440], harmonics_amp=['1'], tilt_type=['default'], num_signals=1, samp_freq=16000)[source]

Generate complex tone.

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

  • fundamental_freq (Sequence[float]) – The fundamental frequency of complex tone in Hz. This value determines the interval of each frequency peak. Defaults to [440].

  • num_harmonics (Sequence[int]) – The number of harmonics. Defaults to [10].

  • first_harmonic_freq (Sequence[float]) – The frequency of first harmonics. When this value is not same value as –complex-tone-fundamental-freq or a multiple of –complex-tone-fundamental-freq, the output signal becomes inharmonic. Defaults to [440].

  • harmonics_amp (Sequence[str]) – Relative amplitude of each harmonics. The format is like 2_1_1_1 which is meant that the first harmonics has twice as much amplitude as the other three harmonics. Defaults to [“1”] which generates the same amplitude signal for all harmonics.

  • tilt_type (Sequence[str]) – Type of spectral tilt. up, down means 6, -6 dB/Oct, respectively. default will do nothing.

  • 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.