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
37 stars 11 forks source link

sound_obj.volume(int) TypeError: 'int' object is not callable #7

Closed 1Ghasthunter1 closed 3 years ago

1Ghasthunter1 commented 3 years ago

Python 3.9.0 Windows 10 Version 2004 OS Build 19041.572 Not sure if this is my fault or libs fault, but when running this code: sound_obj.volume(current_volume) where current_volumeis an int between 0 and 100, and sound_obj = AudioPlayer("sound/soundfile.mp3") and is currently playing with block=False, and audioplayer is imported as: from audioplayer import AudioPlayer

A TypeError is raised, TypeError: 'int' object is not callable.

I understand that the sound_obj.volume is an intbeing returned from the AudioPlayerclass, but I looked at the code inside the library and I'm not the best with decorators and couldn't understand how the volume was supposed to be set.

1Ghasthunter1 commented 3 years ago

Solved the issue, just had to check your example. Proper way to do it: sound_obj.volume = volume_value, where volume_valueis from 0-100. I learned this from the example, but you might want to consider adding this in the docs so it's a little more clear. Thanks for publishing this lib though, very useful.

mjbrusso commented 3 years ago

Hi,

volume is a property, not a method, so use obj.volume = value

I will improve the documentation with code snippets.