Advertisement
dimkiriakos

playsound python

Apr 28th, 2022
825
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. from playsound import playsound
  2. from pathlib import Path
  3.  
  4.  
  5. # audioFile = './botanic_british.mp3'
  6. audioFile = ''
  7.  
  8.  
  9. def play_sound():
  10.     path = Path(audioFile).is_file()
  11.     if path:
  12.         playsound(audioFile)
  13.         return 'ok'
  14.     return "The file doesn't exists"
  15.  
  16.    
  17.  
  18.  
  19. err = play_sound()
  20. print(err)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement