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. 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/

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.3.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

learnByHear-0.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: learnbyhear-0.3.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

Hashes for learnbyhear-0.3.tar.gz
Algorithm Hash digest
SHA256 a5b69f3c056a657823fbd6b9c3b56402a2fd955f77b5c5a16c44d6f29c0a1f09
MD5 6b5e7c513c66b4d9b21c7b1da574d6ab
BLAKE2b-256 773cda46260a84086a82fa20eaf643b8c94d7ce209fadcb0bbc26b6b19b45707

See more details on using hashes here.

File details

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

File metadata

  • Download URL: learnByHear-0.3-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

Hashes for learnByHear-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5a8b2970781ec545c7a8d03d962a2fd57edba304d68ae24694b45974f316560a
MD5 c80630a33bc735a95a86f18226090c83
BLAKE2b-256 389b89c9a9a1cab501f224a7d6a10b298f7c71b970d93b391c8498516f0df6f2

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