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.

Install using pip: pip install learnbyhear

Requires ffmpeg!

Considerations

  • Argos Translate is a bit heavy (~5 GB) because of torch, so keep enough free space
  • 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.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: learnbyhear-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d2c10eb7e6120bf8fb1c2f26b27292ffd5e57e7b7db49b71eba5040ad1c25f30
MD5 1b3fc66891e79ab761cfdd977bd684ac
BLAKE2b-256 44df9492bd16614a0fb5cc9d53ae4462315a42f7751c01c06436a3c8252d2a8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: learnByHear-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fb17b3a75f531b875a287935decf0b936bca22b1adee1028213489a6b015ea3
MD5 8ca248a65172acee18d88318a4b9062a
BLAKE2b-256 9eba3e435dadfaef9d1aa9a1c43c5e6a4fc2dbdb132ad9fd9b76b8b4ce00daf2

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