Skip to main content

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

learnbyhear-0.1.2.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

learnByHear-0.1.2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file learnbyhear-0.1.2.tar.gz.

File metadata

  • Download URL: learnbyhear-0.1.2.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for learnbyhear-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a794656a20b533c06c6a50a94d0d42ce7034cba4ceb16a76e5799a10679c43e9
MD5 ca46fa70951e785c15094c5f3dcaba2e
BLAKE2b-256 df230bba9a94c955026a44d98030c1253dd91b6d5ed038e280b53e5d50c22c0b

See more details on using hashes here.

File details

Details for the file learnByHear-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: learnByHear-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for learnByHear-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab1001eee0607b7913fc14c084f0975045c7412af4b4d49dea1965e2904f39c5
MD5 d64f6c6a34f759c5ffc6ad4c8a0f073a
BLAKE2b-256 35046070d8ce8a62733d6bbdd0c90dc741692ec982f2dbf7b0e2cc9f5c39fb0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page