spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.15k stars 260 forks source link

Fix flakey ResampledReadableAudioFile test. #241

Closed psobot closed 1 year ago

psobot commented 1 year ago

In some situations, the test_mp3_duration_estimate test may fail due to the fact that we're using a fractional sample rate in the test (1234.56 Hz) as a "stress test." This PR makes the test more deterministic by reading the entire contents of the test audio file until exact_duration_known is True, which ensures that the ResampledReadableAudioFile pulls through all of the audio data from its underlying file object.