Giter Site home page Giter Site logo

text-to-speech's Introduction

Text To Speech

Text to speech is a Python program and can be used to read text. Currently it has English and Hindi language reading support via CLI arguments. For other language support you need to configure the code accordingly.

Requirements

System requirements:
  • You must have Python 3 installed in your system.
  • All commands should be run in Python 3 environment.
Prerequisite knowledge:
  • Basic understanding of Python
  • Basic understanding of Terminal or Command Prompt

Getting Started

  1. Create virtual environment
python3 -m venv .text-to-speech
  1. Activate the virtual environment
. .text-to-speech/bin/activate
  1. Install the required python packages
pip install -r requirements.txt
pip install pypiwin32 # Windows only
  1. Run the project
python main.py

Command Line Options

  1. -t or --text for cli input of text.
python main.py -t "This is input from command line"
  1. -l or --language for cli input of language. Currently it support Hindi and English. Available inputs are english and hindi.
python main.py -t Hello -l english
  1. -a or --accent for cli input of language accent. Only available for english language. Available accents are indian, australian, us and uk. For Hindi it is default set to indian accent.
python main.py -t Hello -l english -a uk
  1. -g or --gender for cli input of voice gender. Available inputs are male and female. By default it is set to male.
python main.py -t Hello -l english -a uk -g female
  1. -i or --index to select rank of the reader form the output list. It starts from 0 (Zero). If you don't select any index it will automatically take the first one.
python main.py -t Hello -l english -a us -g female -i 1

NOTE : Sometimes there might be chances that the readers are not available for specific gender or language or accent. In that case, it tries to find alternative or else it will read by the default reader which has English language, US accent and voice gender is male.

Troubleshooting

  • OSError: libespeak.so.1: cannot open shared object file: No such file or directory. Install libespeak library in your system. If you're using ubuntu you can do it by sudo apt install libespeak1.
# for Debian based OS
export LD_LIBRARY_PATH=/path/to/libespeak/directory:$LD_LIBRARY_PATH
  • aplay: not found your system needs alsa utils library. If you're on ubuntu you can do it by sudo apt-get install alsa-utils.

  • aplay: main:788: audio open error: No such file or directory or any other aplay related error. Your system should have soundcard on it. You can check this by aplay -l. As a result of this command if you see something like aplay: device_list:270: no soundcards found... this application will not work for you.

Dependencies

Contributing

  1. Fork it ( https://github.com/vishalnagda1/text-to-speech/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request.

text-to-speech's People

Contributors

vishalnagda1 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

text-to-speech's Issues

Error with all combinations

Traceback (most recent call last):
File "/Users/aaron.jorgensen/code/text-to-speech-master/main.py", line 100, in
update_language(reader, language, accent, gender)
File "/Users/aaron.jorgensen/code/text-to-speech-master/main.py", line 67, in update_language
filtered_voice_list = filter_voice(reader.getProperty(
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/pyttsx3/engine.py", line 146, in getProperty
return self.proxy.getProperty(name)
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/pyttsx3/driver.py", line 173, in getProperty
return self._driver.getProperty(name)
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/pyttsx3/drivers/nsss.py", line 69, in getProperty
return [self.toVoice(NSSpeechSynthesizer.attributesForVoice(v))
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/pyttsx3/drivers/nsss.py", line 69, in
return [self.toVoice(NSSpeechSynthesizer.attributesForVoice(v))
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/pyttsx3/drivers/nsss.py", line 64, in _toVoice
attr['VoiceAge'])
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/objc/_convenience_mapping.py", line 18, in _getitem__objectForKey
return container_unwrap(res, KeyError, key)
File "/Users/aaron.jorgensen/Library/Python/3.9/lib/python/site-packages/objc/_convenience.py", line 134, in container_unwrap
raise exc_type(*exc_args)
KeyError: 'VoiceAge'
Someting went wrong; please report the issue at https://github.com/vishalnagda1/text-to-speech/issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.