Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
/ capriccio Public archive

A simple alarm clock module written in Python

License

Notifications You must be signed in to change notification settings

yuhuili/capriccio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capriccio

A simple alarm clock module written in Python. You could set the alarm audio to any audio file, or let capriccio generate new music everyday~

Dependencies

pyglet, for playing audio. Pyglet also requires AVbin to decode mp3 files.

mingus, for SoundGen, capriccio's sound generator

fluidsynth for MIDI playback

Example (with an audio file)

import capriccio

t = datetime.datetime.now() + datetime.timedelta(seconds=10)
a = capriccio.Alarm(t, "alarm.mp3")

# Make sure a is retained, or else when the main thread ends, this alarm will also be released.

a.destroy() # Stop the alarm clock.

Example (let capriccio automatically generate music)

import capriccio

t = datetime.datetime.now() + datetime.timedelta(seconds=10)
a = capriccio.Alarm(t, 0, True)

# Make sure a is retained, or else when the main thread ends, this alarm will also be released.

a.destroy() # Stop the alarm clock.

or to run it directly, use

$ python capriccio.py -d <delay in seconds> -t <audio filename>
$ python capriccio.py -d <delay in seconds> -i <instrument id>

Available instruments

Currently the following instruments are available for SoundGen:

id Name MiDi
* Electric Grand Piano 3
1 Pan Flute 76
2 French Horn 61
3 Lead 8 (bass + lead) 88
4 FX 3 (crystal) 99
5 Steel Drums 115
6 Bird Tweet 124
7 Gunshot 128
8 String Ensemble 2 50
9 Piccolo 73

*: Default (anything not in the list)

License

capriccio is released under the MIT license. See LICENSE for details.

Audio files within Sounds directory are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

About

A simple alarm clock module written in Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages