- Real-time Translation: Captures live audio input and translates it instantly.
- Multiple Output Options: Supports various output options, including Speaker and Mumble.
- Customizable Translators: Easily switch between different translation services like AWS.
-
Python 3.11+
-
PortAudio:
- Windows: No specific installation required;
PyAudio
includes PortAudio binaries.pip install pyaudio
- Ubuntu: Install PortAudio via package manager:
sudo apt-get install portaudio19-dev/opus
- Mac OS X: Install PortAudio using Homebrew:
brew install portaudio
- Windows: No specific installation required;
-
Opus:
- Windows: Follow the installation Guide.
- Linux: Install Opus via package manager (not tested):
sudo apt-get install libopus0 (Arch Linux opus/lib32-opus)
- Mac OS X: Install Opus using Homebrew:
Then copy the Opus library to
brew install opus
/usr/local/lib/
:sudo mkdir -p /usr/local/lib sudo cp $(brew --prefix opus)/lib/libopus.* /usr/local/lib/
-
pipenv:
pip install pipenv
-
Clone the repository:
git clone https://github.com/RaHummel/live-translation.git cd live-translation
-
Create a virtual environment and install dependencies:
pipenv install
To bundle the entire project into a deployable package:
make bundle // Linux, OS X
.\build.ps1 bundle // Windows
Follow the AWS Setup Guide
Supported languages and voice configurations can be found in the AWS Polly Documentation.
For detailed instructions on setting up Mumble, refer to the Mumble Setup Guide
To help you identify and configure available audio input and output devices on your system, you can use the List_devices.py
script located in the src/helpers
directory. This script lists all available devices, which you can then specify in the config.json
file for the inputDevice
and outputDevice
settings.
-
Navigate to the
src/helpers
directory:cd src/helpers
-
Run the
List_devices.py
script:python List_devices.py
-
The script will output a list of all available audio devices. Use the device names from this list to configure your
config.json
file.
Example output:
Input Devices:
0. Microphone (Realtek Audio)
1. USB Microphone
Output Devices:
0. Speakers (Realtek Audio)
1. Headphones (USB Audio)
The configuration file is located at res/config.json
. It allows you to set parameters for the translator, input, and output devices.
Example Configuration:
{
"inputDevice": "default",
"output": {
"mumble": {
"ipAddress": "localhost",
"port": 64738,
"languageChannelMapping": {
"en": "Channel/Subchannel"
}
},
"speaker": {
"outputDevice": "default"
}
},
"translator": {
"aws": {
"region": "eu-central-1",
"source_language": {
"de": "de-DE",
"en": "en-US"
},
"target_language": {
"en": {
"language_code": "en-US",
"voice_id": "Kendra"
},
"pl": {
"language_code": "pl-PL",
"voice_id": "Jacek"
},
"ru": {
"language_code": "ru-RU",
"voice_id": "Maxim"
},
"de": {
"language_code": "de-DE",
"voice_id": "Vicki"
}
}
}
}
}
After extracting the bundled zip file to your desired location, run the translation service with the following command:
python main.py
Command-line Arguments
-t, --translator
: Translator to use (default: aws)-i, --input
: Sound input method to use (default: mic)-o, --output
: Sound output method to use (default: mumble)-sl, --source_lang
: Source language (default: de)-tl, --target_lang
: Target language(s) (default: [en])
- Opuslib and pymumble: These libraries are no longer maintained. Forked versions are used with necessary modifications.
Contributions are welcome! Please fork the repository and submit a pull request.