Learn a new language by hearing it
Project description
Learn By Hearing - learn a new language by hearing it with text-to-speech
Learning a new language is much easier if you hear the same sentence in the new language and also a language you are familiar with.
That's what this package aims to help you do. You input a text file in the language you're familiar with (which contains a list of sentences in separate lines), and you get an audio file that has the audio in the first language and also the second language. Currently the languages supported are only those present in both argostranslate
and piper
.
This is essentially a wrapper running on top of three packages:
* argostranslate
for translation
* piper
for converting text to speech (TTS)
* ffmpeg
for combining the audio files
Documentation
Only tested for Ubuntu 22.04 environment, but this should work on all Linux systems.
To install using pip, first download the requirements.txt
file, and then:
pip install -r requirements.txt
pip install learnbyhear
It separately requires ffmpeg to be already installed in the system!
Considerations
- Argos Translate is a bit heavy because of torch, so keep enough free space (~5 GB)
- Installation may take some time since dependencies must be downloaded
- First usage of any particular model will download that model
Supported languages
- Argos Translate: https://github.com/argosopentech/argos-translate#supported-languages
- Piper: https://github.com/rhasspy/piper#voices
Voice models
Piper languages may have multiple models and also multiple speaking styles; check https://rhasspy.github.io/piper-samples/
Some models present in the above link are NOT available when installed through pip. So if you run into "RuntimeError: Number of .wav files in each dir is unequal", it is most likely a voice not found error, so just keep trying a different voice. In the meanwhile I will investigate further and raise a issue on piper GitHub if necessary.
Currently in learnByHear you can use multiple models as you wish but speakers are not yet supported (coming soon!)
Example usage
English to German (this is the default, outputs stored in tts/):
learnbyhear text_EN.txt
English to German with multiple output models, 1 extra repetition (for each sentence you hear EN+DE+DE), 1 second silence padding, and a specific output directory
learnbyhear text_EN.txt \
--from_code en \
--to_code de \
--out_models de_DE-thorsten-high de_DE-thorsten_emotional-medium \
--in_model en_GB-alan-medium \
--repeats 1 \
--padding 1.0 \
--out_dir OUT_DIR/
List of models available on piper: https://rhasspy.github.io/piper-samples/ Please check this important note: https://gitlab.com/drohi/learnbyhear#voice-models
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.
Source Distribution
Built Distribution
File details
Details for the file learnbyhear-0.2.dev0.tar.gz
.
File metadata
- Download URL: learnbyhear-0.2.dev0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49793ce40cb192eccd2a7190822a1cee9b1deb1646e3d7d0dfa940f9230be9e5 |
|
MD5 | 388283ecd911327aeabccfe1d7fc8391 |
|
BLAKE2b-256 | f800dd0334b31e271283f17c28bf92cf07c02abed0b0febdead0fef720602ae5 |
File details
Details for the file learnByHear-0.2.dev0-py3-none-any.whl
.
File metadata
- Download URL: learnByHear-0.2.dev0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7ca4eadd96e0a7ef4c16f84142ebc086b41bcecba740c23aae2f45aa0118ed9 |
|
MD5 | b43410c54484c653be707ebed4dbb559 |
|
BLAKE2b-256 | 9d42c691a917180e7a549903e6d40cf1e19aa5cafd834dca491800548fa75684 |