treble_tsdk.results.audio_signal

Audio signal and convolved audio handling.

Provides AudioSignal and ConvolvedAudioSignal classes for working with audio waveforms and convolved impulse response data.

Classes

AudioSignal

Audio signal class for handling audio data

ConvolvedAudioSignal

Audio signal produced by convolving an impulse response with an input waveform.

class treble_tsdk.results.audio_signal.AudioSignal

Audio signal class for handling audio data

__init__(data: ndarray, sampling_rate: float, time: ndarray | None = None, source: list[SourceResults] | None = None, receiver: list[ReceiverResults] | None = None, zero_pad_samples: int = 0, normalization_coefficient: float | None = None)

A Class handling all mono impulse response related actions

Parameters:
  • data (np.ndarray) – The time domain impulse response

  • sampling_rate (float) – The sampling rate of the impulse response

  • source (Source | None) – Information on source, defaults to None

  • receiver (Receiver | None) – Information on receiver, defaults to None

  • zero_pad_samples (int) – The number of samples that have been zero padded in the beginning, defaults to 0

  • normalization_coefficient (float | None) – The coefficient used to normalize the data

plot(title: str = 'Audio data')

Plot the audio signal

repeat_to_duration(duration_seconds: float, full_repeat: bool = False, fadeout_samples: int = 1024) AudioSignal' | 'ConvolvedAudioSignal

repeat the audio audio signal to a specified duration

Parameters:
  • duration_seconds (float) – requested duration in seconds

  • full_repeat (bool) – set to true if the signal only should be repeated in full length, i.e. not cut the last repeat of the signal, defaults to False

  • fadeout_samples (int) – number of samples to fade the signal out with, defaults to 1024

Return AudioSignal:

the new audio signal

trim_to_duration(duration_seconds: float, fadeout_samples: int = 1024) AudioSignal' | 'ConvolvedAudioSignal

Trim the audio signal to a specified duration

Parameters:
  • duration_seconds (float) – the requested duration in seconds

  • fadeout_samples (int) – number of samples of fadeout, defaults to 1024

Return AudioSignal:

A new audio signal with the trimmed duration

convolve_with_audio_signal(audio: AudioSignal) AudioSignal

Convolve the impulse response with an audio signal to get a convolved audio signal

Parameters:

audio (AudioSignal) – signal to be convolved with the IR

Return AudioSignal:

The convolved audio signal

class treble_tsdk.results.audio_signal.ConvolvedAudioSignal

Audio signal produced by convolving an impulse response with an input waveform.

Provides utilities to access individual channels, plot, normalize, resample, and manipulate the convolved audio signal.

__init__(data: ndarray, sampling_rate: float, time: ndarray | None = None, source: list[SourceResults] | None = None, receiver: list[ReceiverResults] | None = None, zero_pad_samples: int = 0, normalization_coefficient: float | None = None)

A Class handling all mono impulse response related actions

Parameters:
  • data (np.ndarray) – The time domain impulse response

  • sampling_rate (float) – The sampling rate of the impulse response

  • source (Source | None) – Information on source, defaults to None

  • receiver (Receiver | None) – Information on receiver, defaults to None

  • zero_pad_samples (int) – The number of samples that have been zero padded in the beginning, defaults to 0

  • normalization_coefficient (float | None) – The coefficient used to normalize the data

plot(title: str = 'Convolved audio data')

Plot the convolved audio signal