audiocore¶
Support for audio samples
-
class
audiocore.RawSample(buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000)¶ A raw audio sample buffer in memory
-
sample_rate:Any¶ 32 bit value that dictates how quickly samples are played in Hertz (cycles per second). When the sample is looped, this can change the pitch output without changing the underlying sample. This will not change the sample rate of any active playback. Call
playagain to change it.
-
deinit(self)¶ Deinitialises the AudioOut and releases any hardware resources for reuse.
-
__enter__(self)¶ No-op used by Context Managers.
-
__exit__(self)¶ Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.
-
-
class
audiocore.WaveFile(file: typing.BinaryIO, buffer: bytearray)¶ Load a wave file for audio playback
A .wav file prepped for audio playback. Only mono and stereo files are supported. Samples must be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating an internal buffer.
-
sample_rate:Any¶ 32 bit value that dictates how quickly samples are loaded into the DAC in Hertz (cycles per second). When the sample is looped, this can change the pitch output without changing the underlying sample.
-
bits_per_sample:Any¶ Bits per sample. (read only)
-
channel_count:Any¶ Number of audio channels. (read only)
-
deinit(self)¶ Deinitialises the WaveFile and releases all memory resources for reuse.
-
__enter__(self)¶ No-op used by Context Managers.
-
__exit__(self)¶ Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.
-