Generic audio decoder.
name (str) – Audio file or resource name.
context (Optional[Context], optional) – The context from which the decoder is to be created.
By default current_context() is used.
RuntimeError – If there is neither any context specified nor current.
Preloaded PCM samples coming from a Decoder
Due to implementation details, while this creates decoder objects
from filenames using contexts, it is the superclass of the ABC
(abstract base class) BaseDecoder. Because of this, Decoder
may only initialize an internal one. To use registered factories,
please call the module-level decode function instead.
Channel configuration of the audio being decoded.
Sample frequency, in hertz, of the audio being decoded.
Length of audio in sample frames, falling-back to 0.
Zero-length decoders may not be used to load a Buffer.
Length of audio in seconds, falling-back to 0.0.
Loop points in sample frames.
start (int) – Inclusive starting loop point.
end (int) – Exclusive starting loop point.
If start >= end, all available samples are included
in the loop.
start >= end
Stream audio asynchronously from the decoder.
The decoder must NOT have its read or seek called
from elsewhere while in use.
chunk_len (int) – The number of sample frames to read for each chunk update.
Smaller values will require more frequent updates and
larger values will handle more data with each chunk.
queue_size (int) – The number of chunks to keep queued during playback.
Smaller values use less memory while larger values
improve protection against underruns.
source (Optional[Source], optional) – The source object to play audio. If None is given,
a new one will be created from the current context.
The source used for playing.
Decode and return count sample frames.
If less than the requested count samples is returned,
the end of the audio has been reached.
length of samples of given size
Sample type of the audio being decoded.
Seek to pos, specified in sample frames.
Return if the seek was successful.
Simple object for storing decoder factories.
User-registered factories are tried one after another
if RuntimeError is raised, in lexicographical order.
Internal decoder factories are always used after registered ones.
Return the decoder created from the given resource name.
This first tries user-registered decoder factories in
lexicographical order, then fallback to the internal ones.
Simple object for storing decoder factories
Audio decoder interface.
Applications may derive from this, implement necessary methods,
and use it in places the API wants a BaseDecoder object.
Exceptions raised from BaseDecoder instances are ignored.
Names of available sample types.
Names of available channel configurations.
Return the size of the given number of sample frames.
ValueError – If either channel_config or sample_type is invalid.
RuntimeError – If the byte size result too large.
Return the number of frames stored in the given byte size.