Coders Packet

Alarm in Python

By Mihir Shri

This project is about creating the beep sound of an Alarm in Python 3. Set the duration after which you want your alarm to ring and you will hear the beep sound at the desired time.

This project creates the beep sound of an alarm.

The user needs to enter:

1. The frequency of the beep sound.

2. The duration for which the beep sound should last.

3. The time after which the alarm needs to set off.

 

The output beep sound has been produced using the winsound library available in Python which provides sound playing interface for windows. The winsound.beep(frequency, duration) function takes 2 parameters, frequency of the beep sound, and the duration of the beep sound.

 

The duration after which the alarm will ring (the beep sound will be heard) has to be input by the user and that input has been converted to seconds and passed on as a parameter to the time.sleep(secs) function of the time library in Python which takes the total number of seconds as a parameter and does nothing for that amount of time.

 

The necessary exceptions have also been raised if the input given by the user is not in the correct format.

 

Note: The user first needs to install the "winsound" library by using "pip install winsound" or read their official manual if not using pip.

 

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Mihir Shri (coe18b064)

Download packets of source code on Coders Packet