easygraphics.music package¶
A simple music play module.
Function List¶
load_music |
|
close_music |
|
play_music |
|
pause_music |
|
unpause_music |
|
stop_music |
|
queue_music |
|
is_music_playing |
|
get_music_pos |
|
get_music_volume |
|
set_music_pos |
|
set_music_volume |
|
fade_out_music |
Functions¶
A simple music play library.
You can use it to load and play music files.
A simple example:
>>> from easygraphics.music import *
>>> # For legal reasons please prepare a music file by yourself
>>> load_music("test.mp3")
>>> play_music()
>>> close_music()
-
easygraphics.music.load_music(filename: str) → None¶ Load a music file for playback.
If music playback device is note initialized, it will be initialized automatically.
Use play_music() to play the music.
Parameters: filename – the music file to play
-
easygraphics.music.close_music()¶ Close the music playback device.
-
easygraphics.music.play_music(loops: int = 0, start: float = 0.0) → None¶ Play the music.
Parameters: - loops – loops. 0 means no loop
- start – start position of the music
-
easygraphics.music.pause_music() → None¶ Pause the music playback.
-
easygraphics.music.unpause_music() → None¶ Unpause the music playback.
-
easygraphics.music.stop_music() → None¶ Stop the music playback.
-
easygraphics.music.queue_music(filename: str)¶ Add music to the playing queue.
Parameters: filename – the music file to be queued.
-
easygraphics.music.is_music_playing() → bool¶ Get if the music is playing.
Returns: True if is playing, False if is not.
-
easygraphics.music.get_music_pos() → float¶ Get current music playback position .
Returns: current position
-
easygraphics.music.get_music_volume() → int¶ Return the music playback volume.
Returns: the playback volume.
-
easygraphics.music.set_music_pos(pos: float)¶ Set current music play position.
Parameters: pos – the position to set.
-
easygraphics.music.set_music_volume(volume: int)¶ Set volume of the music playback.
Parameters: volume – volume of the playback
-
easygraphics.music.fade_out_music(time: float)¶ Fade out and stop the music.
Parameters: time – fade out time (in milliseconds)