:mod:`audiocore` ================ .. py:module:: audiocore .. autoapi-nested-parse:: Support for audio samples .. py:class:: RawSample(buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) A raw audio sample buffer in memory .. attribute:: sample_rate :annotation: :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 ``play`` again to change it. .. method:: deinit(self) Deinitialises the AudioOut and releases any hardware resources for reuse. .. method:: __enter__(self) No-op used by Context Managers. .. method:: __exit__(self) Automatically deinitializes the hardware when exiting a context. See :ref:`lifetime-and-contextmanagers` for more info. .. py:class:: 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. .. attribute:: sample_rate :annotation: :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. .. attribute:: bits_per_sample :annotation: :Any Bits per sample. (read only) .. attribute:: channel_count :annotation: :Any Number of audio channels. (read only) .. method:: deinit(self) Deinitialises the WaveFile and releases all memory resources for reuse. .. method:: __enter__(self) No-op used by Context Managers. .. method:: __exit__(self) Automatically deinitializes the hardware when exiting a context. See :ref:`lifetime-and-contextmanagers` for more info.