auditok.io.AudioSource
- class auditok.io.AudioSource(sampling_rate, sample_width, channels)[source]
Base class for audio source objects.
This class provides a foundation for audio source objects. Subclasses are expected to implement methods to open and close an audio stream, as well as to read the desired number of audio samples.
- Parameters:
sampling_rate (int) – The number of samples per second of audio data.
sample_width (int) – The size, in bytes, of each audio sample. Accepted values are 1, 2, or 4.
channels (int) – The number of audio channels.
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
Number of channels in audio stream (alias for channels).
Number of channels in audio stream.
Number of bytes used to represent one audio sample.
Number of samples per second of audio stream.
Number of samples per second of audio stream (alias for sampling_rate).
Number of bytes used to represent one audio sample (alias for sample_width).