flutter-sound-stream icon indicating copy to clipboard operation
flutter-sound-stream copied to clipboard

Is it possible to change the playback speed?

Open Wyctus opened this issue 5 years ago • 4 comments
trafficstars

Can I change the playback speed directly through the library, or should I implement it myself?

Thank you for the help and the great library!

Wyctus avatar Jul 24 '20 18:07 Wyctus

I think you implement it yourself would be a better solution. You can apply multiple filters to the raw audio data before sending it to the player.

Cheers!

CasperPas avatar Jul 26 '20 08:07 CasperPas

Thank you! But I think changing the playback speed is not a raw audio manipulation, but some setting on the underlying Android/iOS player. So maybe it would be a nice feature to have on this library.

What do you think?

Wyctus avatar Jul 26 '20 13:07 Wyctus

I think the easiest way to achieve that without any raw data manipulation is setting the player's frequency higher or lower the recording frequency. However, that would cause a pitch-changed side effect. I'll look into this anyway, hope it wouldn't add too much overhead to the lib 😁

CasperPas avatar Jul 27 '20 11:07 CasperPas

On Android, you can use the setPlaybackParams(PlaybackParams params) method of the Audiotrack to change the speed, without affecting the pitch. I guess something similar exists on iOS too.

Update: On iOS you can use the mAudioEngine.connect(...) method to attach an AVAudioUnitVarispeed.

Hope this helps!

Wyctus avatar Jul 27 '20 13:07 Wyctus