Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sounddevice as sd
- fs = 44100
- duration = 5 # seconds
- Username = "Admin"
- Password = "Password"
- UserInp = ""
- PassInp = ""
- loggedIn = False
- recorded = False
- while not loggedIn:
- UserInp = input("Username: ")
- PassInp = input("Password: ")
- if UserInp == Username and PassInp == Password:
- loggedIn = True
- print("Logged in!")
- while loggedIn:
- options = input("What do you wanna do? (rec, play, save, exit)")
- if options == "rec":
- recorded = True
- myrecording = sd.rec(duration * fs, samplerate=fs, channels=2, dtype='float64')
- print("Recording")
- sd.wait()
- elif options == "play" and recorded:
- sd.play(myrecording, fs)
- sd.wait()
- print("Play Audio Complete")
- elif options == "save" and recorded:
- print("Saving file!")
- if not recorded and options == "play":
- print("No recording to play!")
- if not recorded and options == "save":
- print("No recording to save!")
- if options == "exit":
- break
- else:
- print("Wrong username or password")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement