Sound
API Reference - Sound#
Complete API reference for the wolpie.sound module.
play_sound
#
Attributes#
Classes#
PlaySoundError
#
Bases: Exception
PlaySoundInterface
#
Bases: ABC
WinPlaySound
#
Bases: PlaySoundInterface
NotImplementedPlaySound
#
Bases: PlaySoundInterface
Functions#
ding
#
ding(sound=DEFAULT_DING_FILE)
A context manager that plays a "ding" sound when the block of code inside the context manager finishes executing.
If if fails to play the "ding", it won't raise any errors. After all.. the whole idea of this context manager is to notify you when a long running function is done. Imagine you wait 2 hours just for the nice sound file to fail. And you have to start from scratch. No thanks.
Warning
This function is only officially supported on Windows.
Uses play_sound under the hood.
Example
Tip
If you want sound files, consider https://pixabay.com/sound-effects/search
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sound
|
str | Path
|
The sound file to play. Defaults to a built-in "ding" sound. |
DEFAULT_DING_FILE
|
Yields:
| Type | Description |
|---|---|
None
|
Nothing. |