I'm trying to create an alarm function with Python3. The below code does work but it doesn't seem like this is the most optimal way of achieving something like this. Is there a more pythonic way?
#!/usr/local/bin/python3
import os
import time
def alarm():
os.system('amixer -D pulse sset Master 30%') # >> Set initial volume
for beep in range(0, 20):
time.sleep(.002)
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (.08, 2500))
alarm()