emvoice.signal

Load and store audio signals.

Module Contents

Classes

BaseSignal

Store a signal.

AudioSignal

Load and store an audio signal.

FormantAudioSignal

Load and store an audio signal.

class emvoice.signal.BaseSignal(sig: numpy.ndarray, sr: int)[source]

Store a signal.

Parameters:
property idx: numpy.ndarray[source]

Sample indices (read-only).

property ts: numpy.ndarray[source]

Sample timestamps (read-only).

class emvoice.signal.AudioSignal(sig: numpy.ndarray, sr: int, mono: bool = True, filename: Optional[str] = None)[source]

Bases: BaseSignal

Load and store an audio signal.

Parameters:
  • sig (numpy.ndarray) – Audio signal.

  • sr (int) – Sampling rate.

  • mono (bool, default=True) – Whether the signal has been converted to mono or not.

  • filename (str, optional) – Name of the audio file associated with the signal.

classmethod from_file(filename: str, sr: Optional[float] = None, mono: bool = True)[source]

Load a signal from an audio file.

Parameters:
  • filename (str) – Name of the audio file. File types must be supported by soundfile or audiofile. See librosa.load().

  • sr (float, optional, default=None) – Sampling rate. If None, is detected from the file, otherwise the signal is resampled.

  • mono (bool, default=True) – Whether to convert the signal to mono.

class emvoice.signal.FormantAudioSignal(sig: numpy.ndarray, sr: int, mono: bool, filename: Optional[str], preemphasis_from: Optional[float])[source]

Bases: AudioSignal

Load and store an audio signal.

Parameters:
  • sig (numpy.ndarray) – Audio signal.

  • sr (int) – Sampling rate.

  • mono (bool, default=True) – Whether the signal has been converted to mono or not.

  • filename (str, optional) – Name of the audio file associated with the signal.

classmethod from_file(filename: str, sr: Optional[float] = None, mono: bool = True, preemphasis_from: Optional[float] = 50.0)[source]

Load a signal from an audio file.

Parameters:
  • filename (str) – Name of the audio file. File types must be supported by soundfile or audiofile. See librosa.load().

  • sr (float, optional, default=None) – Sampling rate. If None, is detected from the file, otherwise the signal is resampled.

  • mono (bool, default=True) – Whether to convert the signal to mono.

  • preemphasis_from (float, optional, default=50.0) – Pre-emphasize the signal from this value onwards (in Hz).