Repository navigation
Expand file tree
/
Copy pathconfig.py
More file actions
167 lines (150 loc) · 7.61 KB
/
Copy pathconfig.py
File metadata and controls
167 lines (150 loc) · 7.61 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
"""
Configuration file for Stonic voice assistant
Contains settings that can be customized
"""
import os
from typing import Dict, Any
# User Configuration
USER_NAME = "Himanshu" # Change this to your name
# Language settings
LANGUAGE_SETTINGS = {
"primary_language": "en-IN", # English (India)
"secondary_language": "hi-IN", # Hindi
"use_multilingual": True, # Enable multilingual support
}
# Bilingual responses
BILINGUAL_RESPONSES = {
"greeting": {
"en": [
"Hello, Stonic at your service.",
"Good day, Stonic is ready.",
"At your command, Stonic is listening.",
"Stonic activated and ready to assist you.",
],
"hi": [
"नमस्ते, स्टोनिक आपकी सेवा में है।",
"शुभ दिन, स्टोनिक तैयार है।",
"आपके आदेश पर स्टोनिक हाज़िर है।",
"स्टोनिक सक्रिय है और आपकी सहायता के लिए तैयार है।",
]
},
"unknown_command": {
"en": [
"I'm not sure I understand that command. Could you please try again?",
"I didn't catch that. Can you rephrase your request?",
"I'm still learning. Could you try a different command?",
"I'm unable to process that request. Please try something else.",
],
"hi": [
"मुझे यह आदेश समझ नहीं आया। क्या आप फिर से कोशिश कर सकते हैं?",
"मैं समझ नहीं पाया। क्या आप अपना अनुरोध दोहरा सकते हैं?",
"मैं अभी भी सीख रहा हूं। क्या आप कोई अलग आदेश दे सकते हैं?",
"मैं इस अनुरोध को प्रोसेस नहीं कर पा रहा हूं। कृपया कुछ और कोशिश करें।",
]
},
"farewell": {
"en": [
"Goodbye, Stonic signing off.",
"Until next time, Stonic will be here when you need me.",
"Powering down Stonic. Have a great day!",
"Stonic going to sleep mode. Call me when you need me.",
],
"hi": [
"अलविदा, स्टोनिक जा रहा है।",
"अगली बार तक, स्टोनिक यहीं रहेगा जब आपको मेरी ज़रूरत होगी।",
"स्टोनिक बंद हो रहा है। आपका दिन शुभ हो!",
"स्टोनिक स्लीप मोड में जा रहा है। जब ज़रूरत हो तो मुझे बुलाएं।",
]
}
}
# Sound Detection Settings
SOUND_SETTINGS = {
"threshold": 0.3, # Amplitude threshold for sound detection (0.0 to 1.0)
"silence_duration": 1.0, # Duration of silence between sounds (seconds)
"rate": 44100, # Audio sample rate
"chunk": 1024, # Audio chunk size
}
# Speech Recognition Settings
SPEECH_SETTINGS = {
"timeout": 5, # Timeout for listening (seconds)
"phrase_time_limit": 5, # Maximum duration for a single phrase (seconds)
"energy_threshold": 1200, # Energy threshold for speech detection (lower for better sensitivity)
"dynamic_energy_threshold": True, # Automatically adjust energy threshold
"dynamic_energy_adjustment_damping": 0.15, # Responsiveness to ambient noise changes (lower = more responsive)
"dynamic_energy_adjustment_ratio": 1.5, # Ratio for adjusting threshold (higher = more sensitive)
"pause_threshold": 0.5, # Seconds of silence to consider end of phrase
"ambient_noise_adjustment_duration": 1.0, # Duration for ambient noise adjustment (seconds)
"default_microphone_index": None, # Set to an integer to use a specific microphone, None for default
"primary_language": "en-IN", # Primary recognition language
"secondary_language": "en-US", # Fallback language if primary fails
"use_fallback_language": True, # Whether to try secondary language if primary fails
"continuous_listening": True, # Whether to listen continuously instead of on-demand
# Advanced whisper settings (for offline recognition)
"use_whisper": False, # Whether to use OpenAI's Whisper model (offline, requires additional install)
"whisper_model": "base", # Whisper model size: "tiny", "base", "small", "medium", "large"
# Clap detection settings
"clap_detection_enabled": False, # Whether to use clap detection to trigger listening
"clap_threshold": 0.3, # Amplitude threshold for clap detection (0.0 to 1.0)
"clap_silence_duration": 1.0, # Duration of silence between claps (seconds)
}
# Text-to-Speech Settings
TTS_SETTINGS = {
"engine": "edge-tts", # TTS engine to use: "edge-tts" is now default
"rate": "+0%", # Speech rate (can be "+10%" for faster, "-10%" for slower)
"volume": "+0%", # Volume (can be "+10%" for louder, "-10%" for quieter)
"pitch": "+0Hz", # Pitch adjustment (can be "+10Hz" for higher, "-10Hz" for lower)
"voice_id": "en-US-GuyNeural", # Default voice (high quality male voice with passion)
# Speech behavior
"speech_queue_enabled": True, # Whether to queue speech for smooth interaction
"allow_interruption": True, # Whether to allow interrupting current speech with new speech
}
# Application paths - Windows specific
# Update these paths to match your system
APPLICATIONS = {
"chrome": r"C:\Program Files\Google\Chrome\Application\chrome.exe",
"edge": r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe",
"firefox": r"C:\Program Files\Mozilla Firefox\firefox.exe",
"vscode": r"C:\Users\{}\AppData\Local\Programs\Microsoft VS Code\Code.exe".format(os.getenv('USERNAME')),
"notepad": r"notepad.exe",
"explorer": r"explorer.exe",
# Add more applications as needed
}
# Website URLs
WEBSITES = {
"google": "https://www.google.com",
"youtube": "https://www.youtube.com",
"github": "https://www.github.com",
"gmail": "https://www.gmail.com",
"wikipedia": "https://www.wikipedia.org",
# Add more websites as needed
}
# Wake words/phrases (for future implementation)
WAKE_WORDS = [
"hey stonic",
"ok stonic",
"hello stonic",
]
# Personalized responses
GREETING_RESPONSES = [
f"Hello {USER_NAME}, Stonic at your service.",
f"Good day {USER_NAME}, Stonic is ready.",
f"At your command {USER_NAME}, Stonic is listening.",
f"Stonic activated and ready to assist you, {USER_NAME}.",
]
UNKNOWN_COMMAND_RESPONSES = [
"I'm not sure I understand that command. Could you please try again?",
"I didn't catch that. Can you rephrase your request?",
"I'm still learning. Could you try a different command?",
"I'm unable to process that request. Please try something else.",
]
FAREWELL_RESPONSES = [
f"Goodbye {USER_NAME}, Stonic signing off.",
f"Until next time {USER_NAME}, Stonic will be here when you need me.",
f"Powering down Stonic. Have a great day {USER_NAME}!",
f"Stonic going to sleep mode. Call me when you need me, {USER_NAME}.",
]
# Path for logging
LOG_FILE = "stonic.log"
LOG_LEVEL = "INFO" # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
# Cohere API Configuration
COHERE_API_KEY = "8BhJnWAqx1onXgtXe37dEfhbdwMHdttXxg3RRf4q" # Replace with your actual API key