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

Uploaded Source

Built Distribution

learnByHear-0.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: learnbyhear-0.1.tar.gz
  • Upload date:
  • Size: 17.0 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.tar.gz
Algorithm Hash digest
SHA256 85c4005b2d5807ae07ad12a1338b3feda7222ae13ba13ff4a1645038efb36d9b
MD5 c8e32552dad47527500881c08a139da1
BLAKE2b-256 ea0e51508bdd5e048239b7415e57f5a5cec6ec8bd21d0e321b1d11e0179b77c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: learnByHear-0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 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-py3-none-any.whl
Algorithm Hash digest
SHA256 6db4941f2318b46c500b80dd55d2e24c9ed81c2c8b2597e07e292e2d1582e5bc
MD5 9b1e4401c8dd192e77d9b5ae5254be42
BLAKE2b-256 909f7489ea2c5a181a514a7f22026c305d97860084fdf4431fff6958de69eced

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