Advertisement
here2share

# audio_rec_and_play.py

May 17th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # audio_rec_and_play.py
  2.  
  3. import time
  4. import audio
  5. import os
  6.  
  7. print "Audio Demo --"
  8.  
  9. dir_audio = (u"e:\\audiotest.wav")
  10. s = audio.Sound.open(dir_audio)
  11.  
  12. print dir(s)
  13.  
  14. s.record()
  15. print "5 SECONDS OF RECORDING IS NOW COMMENCED..."
  16. time.sleep(5)
  17. s.stop()
  18. print "WILL NOW PLAY THE RECORDED AUDIO..."
  19. time.sleep(2)
  20. s.play()
  21.  
  22. time.sleep(5)
  23.  
  24. s.close()
  25. os.remove(dir_audio) # first needs to be closed
  26. print "Done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement