PythonistaGuild / TwitchIO

An Async Bot/API wrapper for Twitch made in Python.
https://twitchio.dev
MIT License
785 stars 163 forks source link

Sounds.ext fixes #454

Closed sockheadrps closed 2 months ago

sockheadrps commented 2 months ago

edit: Added TinyTag as a dependency to detect audio file meta data for channels and rate to auto set those values. TinyTag is MIT and has no external dependencies of its own

Pull request summary

This could be a solution to #358

The sample rate of audio for Sound is hard coded (it might have something to do with YTDL, Im not sure), however if you create a sound using a local file

Sound(source="my_audio.mp3")

it's possible and likely to have files with different sample rates. Ive personally run into this issue and have seen others run into it as well, and the only solution right now is to hack at the library code to change the sample rate manually.

This PR just gives Sound.rate and Sound.channels a setter on each class property. Maybe in the future I can look at pulling sample meta data from the suppled audio file, but sometimes that can even be wrong so those class properties kind of need to be able to be set.

Checklist

Im closing the other PR, I managed to mess up the other branch beyond repair lol. This is an identical PR to the one before.