2019-04-09 00:13:16 +10:00
# LinVAM
Linux Voice Activated Macro
2020-05-17 04:51:24 +10:00
2019-04-17 13:52:40 +10:00
## Status
2019-04-21 22:58:46 +10:00
This project is currently a work-in-progress and is minimally functional only for english.
2019-04-19 21:59:58 +10:00
Utilising Pocketsphinx, a lightweight voice to text engine you can specify voice commands for the tool to recognise and actions to perform.
Known bugs and planned additions
- To save and use changes click Ok on the main GUI then reload.
- Remember last loaded profile and load on start
- Log window showing spoken words the V2T recognises with ability to right click and assign voice command and actions to current profile
- Support for joysticks and gaming devices
2020-05-17 04:51:24 +10:00
2019-04-17 13:52:40 +10:00
## Requirements
- python3
- PyQt5
- python3-xlib
2019-04-22 01:23:57 +10:00
- pyaudio
2019-04-19 21:59:58 +10:00
- pocketsphinx
- swig3.0
2020-05-17 04:51:24 +10:00
## Optional requirements
- xdotool
- ffplay (part of ffmpeg, usually already installed)
- HCS voicepacks
2019-04-17 13:52:40 +10:00
## Install
- $ pip3 install PyQt5
- $ pip3 install python3-xlib
2019-04-21 22:54:39 +10:00
- $ pip3 install pyaudio
2019-04-19 21:59:58 +10:00
- $ pip3 install pocketsphinx
- $ sudo apt-get install swig3.0
2020-05-17 04:51:24 +10:00
- $ (optional) sudo apt install xdotool
- $ (optional) sudo apt install ffmpeg
2019-04-19 21:59:58 +10:00
- $ sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
2019-04-22 01:11:13 +10:00
- $ git clone https://github.com/aidygus/LinVAM.git
2020-05-17 04:51:24 +10:00
2019-04-17 13:52:40 +10:00
## Usage
This script must be run with root privilege because it must hook and simulate input devices such as keyboard, mouse etc.
- $ cd LinVAM
- $ xhost +
2019-04-21 22:58:46 +10:00
- $ sudo ./main.py
2019-04-17 13:52:40 +10:00
2020-05-17 04:51:24 +10:00
As an alternative, if you use the X window manager and have xdotool installed, you can run the script like this:
- $ cd LinVAM
- $ ./main.py -noroot
2019-04-19 21:59:58 +10:00
### Profiles
Multiple profiles are supported. To create a new profile for a specific task/game click new and the main profile editor window will be displayed
2019-04-19 22:05:36 +10:00
2019-04-19 22:05:01 +10:00
![Main GUI ](https://raw.githubusercontent.com/aidygus/LinVAM/master/.img/gui.png )
2019-04-19 21:59:58 +10:00
### Key combinations
To assign key combinations first decide which functional key to press by clicking on Ctrl, Alt, Shift or Win to denote left or right key then press the actual command key
2019-04-19 22:05:36 +10:00
2019-04-19 22:05:01 +10:00
![Main GUI ](https://raw.githubusercontent.com/aidygus/LinVAM/master/.img/combination.png )
2019-04-19 21:59:58 +10:00
### Complex commands
It is possible to add multiple actions to a voice command for complex macros with the ability to add a pause between each action.
You can also assign mouse movements and system commands if you require (eg opening applications such as calculator, browser etc)
2019-04-19 22:05:36 +10:00
2019-04-19 22:05:01 +10:00
![Main GUI ](https://raw.githubusercontent.com/aidygus/LinVAM/master/.img/complex.png )
2019-04-19 21:59:58 +10:00
### Threshold
As a rough guide use a value of 10 for each syllable of a word then tweak it down for better accuracy.
2020-05-17 04:51:24 +10:00
### Output audio
In the Command Edit Dialog, chose 'Other' and then 'Play sound'. Pick the sound you would like to play.
For this to work you need to copy any audio file you would like to use to the folder 'voicepacks'.
You are required to create a subfolder to hold all your audio files (voicepack folder), then within that subfolder, create as many folders as you like to group your audio files (category folders).
Place the audio file into these category folders or in any subfolder within a category folder.
In theory any audio file should work, but tested only with MP3 files.
Example:
/voicepacks/my voicepack/custom commands/hello.mp3
/voicepacks/my voicepack/other/thank you.mp3
If you own a HCS voicepack, copy the whole voicepack folder (like 'hcspack', 'hcspack-eden', ...) to the 'voicepacks' folder, so it reads like this:
/voicepacks/hcspack/...
### Improve voice recognition accuracy
2020-05-23 01:11:13 +10:00
Please see this resource on how to train the acoustic model of pocketsphinx to match your voice:
2020-05-17 04:51:24 +10:00
https://cmusphinx.github.io/wiki/tutorialadapt/