circuitpython/shared-bindings/audiomp3
Ben Combee 98b0029a29 audiomp3: add decoded_samples property
In my testing, there is no way to accurately know how far into a MP3 file
you're currently playing. You can use monotonic time, but that can have
drift versus the audio playback system, which may not be running at exactly
the expected sample rate.

To allow syncing animation with timestamps in a MP3 file, this presents a
new property, decoded_samples, that records the number of audio samples
sent out of the decoder. While this may not be a completely accurate time,
due to mixer delays, it's much better position that the monotonic clock
difference.

Implementation is keeping track of this value in the mp3file structure and
adding to it whenever data is sent out of the decoder. The property
implementation was a copy/paste from current properties in the audiomp3
files.
2022-01-01 23:28:43 -06:00
..
MP3Decoder.c audiomp3: add decoded_samples property 2022-01-01 23:28:43 -06:00
MP3Decoder.h audiomp3: add decoded_samples property 2022-01-01 23:28:43 -06:00
__init__.c Convert more modules to use MP_REGISTER_MODULE 2021-08-25 20:48:55 -04:00
__init__.h audiocore: Add MP3File using Adafruit_MP3 library 2019-12-10 14:03:06 -06:00