-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnMapper-sr.py
More file actions
64 lines (46 loc) · 1.92 KB
/
Copy pathnMapper-sr.py
File metadata and controls
64 lines (46 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import speech_recognition as sr
import pyttsx3 as p
import os
intro = '''
:::: ::: ::: ::: ::: ::::::::: ::::::::: :::::::::::::::::::
:+:+: :+: :+:+: :+:+: :+: :+: :+: :+::+: :+::+: :+: :+:
:+:+:+ +:++:+ +:+:+ +:+ +:+ +:+ +:+ +:++:+ +:++:+ +:+ +:+
+#+ +:+ +#++#+ +:+ +#++#++:++#++:+#++:++#+ +#++:++#+ +#++:++# +#++:++#:
+#+ +#+#+#+#+ +#++#+ +#++#+ +#+ +#+ +#+ +#+
#+# #+#+##+# #+##+# #+##+# #+# #+# #+# #+#
### ####### ###### ###### ### ############# ###
Version : 1.0
Author : Orhan YILDIRIM
Medium : @orhan_yildirim
Linkedin : www.linkedin.com/in/orhan-yildirim
License : MIT License
Note : Who's up!
You can use "help" command for access help section.
'''
print(intro)
engine = p.init()
voices = engine.getProperty('voices')
#engine.setProperty('voice', voices[0].id) # changing index, changes voices. 0 for male
engine.setProperty('voice', voices[1].id) # changing index, changes voices. 1 for female
engine.setProperty('rate', 140)
r = sr.Recognizer()
def speak(str):
engine.say(str)
engine.runAndWait()
print('[nMapper] Starting...')
speak('Starting nMapper!')
with sr.Microphone() as source:
speak('nMapper, is at your service')
print('[nMapper] You can speak...')
text = r.listen(source)
try:
recognized_text = r.recognize_google(text)
print('[nMapper] Your command is: ', recognized_text)
except sr.UnknownValueError:
print("[nMapper] Unknown command!")
except sr.RequestError as e:
print("")
if 'help' in recognized_text:
os.system('help')
if 'who' in recognized_text:
os.system('whoami')