Skip to main content

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. Best to use it in a virtual environment, as you should do with any Python package!

To install using pip, first download the requirements.txt file, and then:

pip install -r requirements.txt
pip install learnbyhear

You need to separately have ffmpeg already installed in the system!

Considerations

  • Dependencies are a bit heavy, 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
  • I designed it such that it is meant to be used once a large text file, and then never. Yes, this is also my excuse for not optimizing it ;)

Supported languages

Currently the languages supported are only those present in both argostranslate and piper.

Voice models

Piper languages may have multiple models and also multiple speaking styles; check https://rhasspy.github.io/piper-samples/

Multiple models and speakers are supported!

Example usage

English to German (this is the default, outputs stored in tts/):

learnbyhear text_EN.txt

English to German with three different output models (two of them actually a different speaker from the same model), 1 extra repetition (for each sentence you hear EN + DE_model_1 + DE_model_2 + DE_model_3 + DE_model_1 + DE_model_2 + DE_model_3), 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:4 de_DE-thorsten_emotional-medium:5 \
    --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/

Metadata

Release files for learnByHear 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for learnByHear 0.3
File Size Uploaded
learnbyhear-0.3.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for learnByHear 0.3
File Interpreter ABI Platform
learnByHear-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / learnbyhear-0.3.tar.gz

Download URL learnbyhear-0.3.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a5b69f3c056a657823fbd6b9c3b56402a2fd955f77b5c5a16c44d6f29c0a1f09
BLAKE2b-256 checksum
How to use checksums
773cda46260a84086a82fa20eaf643b8c94d7ce209fadcb0bbc26b6b19b45707
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / learnByHear-0.3-py3-none-any.whl

Download URL learnByHear-0.3-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a8b2970781ec545c7a8d03d962a2fd57edba304d68ae24694b45974f316560a
BLAKE2b-256 checksum
How to use checksums
389b89c9a9a1cab501f224a7d6a10b298f7c71b970d93b391c8498516f0df6f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page