So I am trying to play a simple beep after my code has finished because it takes a while to crunch a lot of data. I have tried other examples on the web, but nothing seems to work. I have tried:
import sys
sys.stdout.write('\a')
sys.stdout.flush()
which outputs the word bel in the IDE shell, but nothing else
I have also tried:
import os
print('\a')
which outputs the same exact thing.
And I have tried
import os
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % ( 4, 4))
which simply outputs:
sh: play: command not found
Anybody have any ideas?
Also here is a jpg containing the word bell. It looks funny...
I also made sure my volume was up
UPDATE: It might just be my IDE. I tried launching python directly from terminal and using write('\a') and it worked. It just won't work in wing 101
Acutually,sys.stdout.write('\a')
works for me,but not in IDE,try to run this code in Terminal.You will hear the system sound.
Also you can try this two command:
say
afplay
e.g.
import os
os.system('say "Beer time."')
import os
os.system('afplay /System/Library/Sounds/Sosumi.aiff')
Run man say
to see more details.
say Hello, World.
say -v Alex -o hi -f hello_world.txt.
say --interactive=/green spending each day the color of the leaves.
say -o hi.aac 'Hello, [[slnc 200]] World'.
say -o hi.m4a --data-format=alac Hello, World.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With