Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. import sounddevice as sd
  2.  
  3. fs = 44100
  4. duration = 5 # seconds
  5. Username = "Admin"
  6. Password = "Password"
  7. UserInp = ""
  8. PassInp = ""
  9. loggedIn = False
  10. recorded = False
  11.  
  12. while not loggedIn:
  13. UserInp = input("Username: ")
  14. PassInp = input("Password: ")
  15. if UserInp == Username and PassInp == Password:
  16. loggedIn = True
  17. print("Logged in!")
  18. while loggedIn:
  19. options = input("What do you wanna do? (rec, play, save, exit)")
  20. if options == "rec":
  21. recorded = True
  22. myrecording = sd.rec(duration * fs, samplerate=fs, channels=2, dtype='float64')
  23. print("Recording")
  24. sd.wait()
  25. elif options == "play" and recorded:
  26. sd.play(myrecording, fs)
  27. sd.wait()
  28. print("Play Audio Complete")
  29. elif options == "save" and recorded:
  30. print("Saving file!")
  31. if not recorded and options == "play":
  32. print("No recording to play!")
  33. if not recorded and options == "save":
  34. print("No recording to save!")
  35. if options == "exit":
  36. break
  37. else:
  38. print("Wrong username or password")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement