:mod:`audiomp3` =============== .. py:module:: audiomp3 .. autoapi-nested-parse:: Support for MP3-compressed audio files .. py:class:: MP3(file: typing.BinaryIO, buffer: bytearray) Load a mp3 file for audio playback .. attribute:: file :annotation: :Any File to play back. .. 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) .. attribute:: rms_level :annotation: :Any The RMS audio level of a recently played moment of audio. (read only) .. method:: deinit(self) Deinitialises the MP3 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.