Beeply module in Python
Last Updated :
03 Jun, 2021
The beeply module in python will helps you produce musical notes using your computer’s characteristic beep sounds. It’s completely written in python ( using winsound and time module to be precise )
As this module is written using winsound, it will work only on Windows. This module contains only one class and a single method i.e beeply class and head() method.
Installation:
pip install beeply
Below are some examples which depicts the use of beeply module:
Example 1
A scale is the tonal basis of music. It is a set of tones from which one can generate melodies. The underscore _ is used for scale of sound If _ is given, it’s scale will be 1
Syntax:
obj = notes.beeps(duration in ms)
beeps is class, it’s constructor takes an arg ( optional ) of time duration if not given it will take it as 900 ms
If given make sure it’s in ms.
obj.hear(self,duration in ms)
Python3
from beeply.notes import *
a = beeps()
a.hear( 'A_' )
print ( "Done " )
a.hear( "A" )
|
Output:
It will produce tone of A at scale 1 and the at scale 0, you can head 2 beeps for 0.9 sec each.
Example 2
Python3
from beeply.notes import *
a = beeps( 1154 )
a.hear( 'A_' )
a.head( 'A_' , 5000 )
print ( "Done" )
|
Output:
If you will give duration as argument while making object ( i.e. while instantiating ) then it will be default duration for hear function too if not given specifically.
Share your thoughts in the comments
Please Login to comment...