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

Playing specific segment of audio #296

Closed Dohg678 closed 5 months ago

Dohg678 commented 7 months ago

Hello, I was wondering if there was a way to play a specific segment of audio from a file (e.g. from 10s to 20s of an mp3 file)

psobot commented 6 months ago

Hi @Dohg678!

Pedalboard doesn’t currently have a mechanism to play back an audio buffer at all - there’s no play function or similar. As a workaround, you can load the section of audio you want to play with the AudioFile class (using seek and read), then play it with another library in Python (or simply write it to a file for later playback with another tool, like ffplay).