faiface / beep

A little package that brings sound to any Go application. Suitable for playback and audio-processing.
MIT License
2.08k stars 151 forks source link

Can I change the SampleRate at runtime? #172

Open hankeyyh opened 4 months ago

dusk125 commented 4 months ago

This project is maintained at https://github.com/gopxl/beep, please direct all future inquiries there.

If you're asking about changing the speaker sample rate after it's been started; no.

For other streamers (decoded from a file or others) it doesn't really make sense to change the sample rate mid stream as they're encoded with a specific sample rate.

If you need to play a piece of audio at a certain different sample rate, then you'll need to resample the audio while playing (or offline for better performance). Beep provides a resampler

dusk125 commented 4 months ago

This project is maintained at https://github.com/gopxl/beep, please direct all future inquiries there.

If you're asking about changing the speaker sample rate after it's been started; no.

For other streamers (decoded from a file or others) it doesn't really make sense to change the sample rate mid stream as they're encoded with a specific sample rate.

If you need to play a piece of audio at a certain different sample rate, then you'll need to resample the audio while playing (or offline for better performance). Beep provides a resampler