Jarvis UI to perform voice commands via API calls
Project description
Deployments
Jarvis UI
Connects to Jarvis
running in the backend to process request and response via API calls.
Kick off
Install
python -m pip install jarvis-ui
Initiate
import jarvis_ui
if __name__ == '__main__':
jarvis_ui.start()
Mandatory Env Vars
- REQUEST_URL: URL to which the API call has to be made. Can be
localhost
or atunneled
URL behind a reverse proxy/CDN. - TOKEN: Authentication token.
Optional Env Vars
- DEBUG: Defaults to
False
- Enable debug level logging - REQUEST_TIMEOUT: Defaults to
5
- Timeout for API calls - SPEECH_TIMEOUT: Defaults to
0
for macOS,5
for Windows - Timeout for speech synthesis - NATIVE_AUDIO: Defaults to
False
- If set toTrue
, the response is generated in the server's default voice - WAKE_WORDS: Defaults to
jarvis
(Defaults toalexa
in macOS older than10.14
) - Wake words to initiate Jarvis - SENSITIVITY: Defaults to
0.5
- Sensitivity of wake word detection - MICROPHONE_INDEX: Defaults to
None
- Use peripherals.py to get the index values - VOICE_NAME: Defaults to the author's favorite per the OS. Name of the voice supported by the OperatingSystem
- VOICE_RATE: Defaults to the value from
pyttsx3
module - Speed/rate at which the text should be spoken - VOICE_TIMEOUT: Defaults to
3
- Timeout for listener once wake word is detected - Awaits for a speech to begin until this limit - VOICE_PHRASE_LIMIT: Defaults to
None
- Timeout for phrase once listener is activated - Listener will be deactivated after this limit - RESTART_TIMER: Defaults to 24 hours.
- I have a proxy tunneling my
localhost
from Jarvis server. - I have a CDN setup that's allowing me to access the tunnel with a custom domain.
- Since I don't want my CDN to take the hit, and the tunnel origin changes often, I'm swapping the URL upon startup.
- This requires restarting the UI every now and then.
- I have a proxy tunneling my
Custom settings for speech recognition
These are customized according to the author's voice pitch. Please use test_listener.py to figure out the suitable values in a trial and error method.
These settings are added (optionally), to avoid the hard coded
VOICE_PHRASE_LIMIT
Cons in using hard codedVOICE_PHRASE_LIMIT
:
- Disables the listener after the set limit even when the speaker is actively talking.
- Listener will be active until the set limit even after the speaker has stopped talking.
Sample settings (formatted as JSON object)
- RECOGNIZER_SETTINGS:
'{"energy_threshold": 1100, "dynamic_energy_threshold": false, "pause_threshold": 1, "phrase_threshold": 0.1}'
Description
- energy_threshold: Minimum audio energy to consider for recording. Greater the value, louder the speech should be.
- dynamic_energy_threshold: Change considerable audio energy threshold dynamically.
- pause_threshold: Seconds of non-speaking audio before a phrase is considered complete.
- phrase_threshold: Minimum seconds of speaking audio before it can be considered a phrase - values below this are ignored. This helps to filter out clicks and pops.
- non_speaking_duration: Seconds of non-speaking audio to keep on both sides of the recording.
Refer Jarvis' README for more information on setting up the backend server.
Coding Standards
Docstring format: Google
Styling conventions: PEP 8
Clean code with pre-commit hooks: flake8
and
isort
Release Notes
Requirement
python -m pip install changelog-generator
Usage
changelog reverse -f release_notes.rst -t 'Release Notes'
Linting
PreCommit
will ensure linting, and the doc creation are run on every commit.
Requirement
pip install --no-cache sphinx==5.1.1 pre-commit recommonmark
Usage
pre-commit run --all-files
Pypi Package
https://pypi.org/project/jarvis-ui/
Runbook
https://thevickypedia.github.io/Jarvis_UI/
License & copyright
© Vignesh Sivanandha Rao
Licensed under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.