HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Beginner Python Tutorial - Alarm with MP3 Sound Notification

40,546 views February 9, 2020 11:47

Watch on YouTube
ChannelSelf Proclaimed Engineer

Description from the creator

Super simple, easy to understand code walked through step by step to produce an alarm clock in Python - all with only 18 lines of code!

import os
import datetime
from playsound import playsound
from AppKit import NSSound
os. system('clear')
alarmH = int(input("What hour do you want the alarm to ring? "))
alarmM = int(input("What minute do you want the alarm to ring? "))
amPm = str(input("am or pm? "))
os. system('clear')
print("Waiting for alarm",alarmH,alarmM,amPm)
if (amPm == "pm"):
alarmH = alarmH + 12
while(1 == 1):
if(alarmH == datetime.datetime.now().hour and
alarmM == datetime.datetime.now().minute) :
print("Time to wake up")
playsound('/your/path/to/file/beep-07.mp3')
break

About this tutorial

Self Proclaimed Engineer published this 11:47 video tutorial on February 9, 2020. It has been watched 40,546 times on YouTube.

Category
Education
Duration
11:47
Published
February 9, 2020
Views
40,546
Likes
580

Tags

Share

This tutorial in other languages