auditok.io.StdinAudioSource

class auditok.io.StdinAudioSource(sampling_rate=16000, sample_width=2, channels=1)[source]

An AudioSource class for reading audio data from standard input.

This class is designed to capture audio data directly from standard input, making it suitable for streaming audio sources.

Parameters:
  • sampling_rate (int, optional, default=16000) – The number of samples per second of audio data.

  • sample_width (int, optional, default=2) – The size in bytes of each audio sample. Accepted values are 1, 2, or 4.

  • channels (int, optional, default=1) – The number of audio channels.

__init__(sampling_rate=16000, sample_width=2, channels=1)[source]

Methods

__init__([sampling_rate, sample_width, channels])

close()

Close audio source.

is_open()

Return True if audio source is open, False otherwise.

open()

Open audio source.

read(size)

Read and return up to size audio samples.

Attributes

ch

Number of channels in audio stream (alias for channels).

channels

Number of channels in audio stream.

sample_width

Number of bytes used to represent one audio sample.

sampling_rate

Number of samples per second of audio stream.

sr

Number of samples per second of audio stream (alias for sampling_rate).

sw

Number of bytes used to represent one audio sample (alias for sample_width).