File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from datetime import datetime
22from playsound import playsound
3+ import winsound
4+
5+
36#input the time in HH:MM where HH is hour and MM is minutes in 12 hour format
4- alarm_date = input ('Enter the date on which you want to set the alarm ' ).strip ()
5- alarm_time = '' .join (input ("Enter the time of alarm to be set: HH:MM AM/PM " ).split ())
7+
8+
9+
10+ alarm_date = input ('Enter the date on which you want to set the alarm: ' ).strip ()
11+ alarm_time = '' .join (input ("Enter the time of alarm to be set in HH:MM,AM/PM format: " ).split ())
12+ music_or_beep = input ("Enter m for a music or b for beep sound: " )
13+ if music_or_beep == 'b' :
14+ dur = int (input ("duration in seconds: " ))* 1000 #winsound takes in milliseconds
15+ freq = int (input ("frequency of the noise: " )) #optimal- 500
616alarm_hour = alarm_time [0 :2 ]
717alarm_minute = alarm_time [3 :5 ]
8- alarm_period = alarm_time [5 :7 ].upper ()
18+ alarm_period = alarm_time [6 :8 ].upper ()
19+
20+
21+
922print ('setting alarm.....' )
23+
24+
25+
1026while True :
1127 current_time = datetime .now ()
1228 current_hour = current_time .strftime ('%I' )
1733 print ('*' * 10 )
1834 print ('| ' + 'Wake up!' + ' |' )
1935 print ('*' * 10 )
20- playsound ('audio.wav' )
36+ if music_or_beep == 'm' :
37+ playsound ('audio.wav' )
38+ else :
39+ winsound .Beep (freq ,dur )
2140 break
You can’t perform that action at this time.
0 commit comments