Show HN: Jazz up your Python scripts with sound effects
Ever wanted your scripts to play song while working/ on erroring out ?
Obviously you did not
But here it’s miles anyway
pip set up jazzit
What it attain ?
Jazzit you will lawful add a decorator to your functions and jazz it up
- That you can have a elevator song to affiliate alongside with your lengthy working script
- Play humiliating song when it errors out to put you for your arena
There are default tracks you will use, or you will use your comprise custom tracks
Straightforward attain it ?
Play Frolic from curb your enthusiasm to protect you for your arena
from jazzit import error_track @error_track("curb_your_enthusiasm.mp3", wait=7) def bolt(): for num in reversed(vary(10)): print(10/num) if __name__ == "__main__": bolt()
Sip espresso to elevator song while your script is working
from jazzit import waiting_track def fibonacci(n): if n < 0: lift Exception("BE POSITIVE !!!") elif n == 1: return 0 elif n == 2: return 1 else: return fibonacci(n - 1) + fibonacci(n - 2) @waiting_track("elevator.mp3") def bolt(limit): for num in vary(1, limit): print(fibonacci(num)) if __name__ == "__main__": bolt(1000)
The in-procure tracks are bruh_moment, elevator and curb_your_enthusiasm but you will add your custom tracks
Strive a number of the examples
⚠️Instruct wisely: Most fitted for scripts you bolt for non-professionally !
Jazz added with playsound
When you are ubuntu and getting hit with
ModuleNotFoundError: No module named 'gi
That it’s doubtless it’s most practical to have to set up Pygobject https://pygobject.readthedocs.io/en/most modern/getting_started.html
I did a lil profiling on bin/profiler.py
Time to bolt : 5.2486350536346436 secs
Time to bolt: 5.270173072814941 secs
python -m memory_profiler bin/profiler.py
Default tracks were pulled from https://www.youtube.com/particular person/gamingsoundfx/
No Copyright Infringement Intended
I would desire down these tracks or add extra reckoning on the series of complaints I procure slapped with