mjbrusso / AudioPlayer

audioplayer is a cross platform Python 3 package for playing sounds (mp3, wav, ...). It provides the key features of an audio player, such as opening a media file, playing (loop/block), pausing, resuming, stopping, and setting the playback volume.
MIT License
39 stars 11 forks source link

Features suggestions? #14

Open Toma400 opened 2 years ago

Toma400 commented 2 years ago

Hello! First of all, I wanted to say that I really love the fact that playsound has really great competitor which seems to be almost everything I've dreamt of trying to use playsound. There are some elements that I would like to ask, though, and if they are not existing - I'd like to suggest.

  1. Do AudioPlayer support running itself via terminal program? Tried running it, but for some reason it didn't really worked for me, didn't showing errors though (except for .volume raising error that 'int' is not callable). This is function which is calling the sound.

  2. How one recognise if there's any music object playing? I am constructing a game which operates on various music files being called, and it would be really helpful to have function that checks if there's any AudioPlayer file being run in exact moment. This way I could run one sound object and forgets about its properties, because whatever they'd be, there'd be a way to check if it is still playing.

  3. This is something which is more of a dream than suggestion, but some form of ".stopFaded" function which would not stop sound immediately, but instead, fade it out for 5-10 seconds, would be also absolutely awesome. This way one could easily make seamless bridges between previous and next track.

Sorry for bothering with such long "issue", just wanted to show my gratitude to some extent ^^'

evilja commented 2 years ago

for 2: you can set a variable to time.time() when you started to play a sound, and then set a variable for length of audio. create a while busy: and put if time.time() > start_time + length_of_audio: busy = False. You'll need threading because of while. only it is sad