Git Product home page Git Product logo

voicy's Introduction

Voicy

Wrapper for free use TTS & STT services.

Installation:

Download library using pip
$ pip3 install voicy -U

Usage example:

Google Cloud

For a request to the Google Cloud client, you need to provide a token. You can easily get it using GoogleToken object, or in a browser by yourself.

Both options are described below:

Automated option
  1. By first, you need to get API key in rucaptcha.
  2. After that import a GoogleToken object from voicy:
    from voicy import GoogleToken
  3. Then provide the API key to the get_token function:
    GoogleToken.get_token(rucaptcha_key="Key, that you got in the rucaptcha account.")
  4. If you do all alright you would get long string, that you should provide to Google object in init.
Browser option
  1. By first, go to cloud.google.com/text-to-speech.
  2. After that scroll down to the demo part.
    Recaptcha
  3. Solve the captcha.
  4. After, open the developer console and go to the "Network" section. In column "Name" search for proxy?url=https://texttospeech.googleapis.com ...
    The developer console
    Scroll to the "Query string parameters". That long string is your token. Provide it to Google object in init.

For using TTS you need to provide a dictionary where the key is your language code and the value is your voice model. Format to both you can find in docs. Also, if you don't want to get a token you can use a TTS from Google Translate.

Simple TTS example:
from voicy import Google

google = Google(token="token")

print(
    google.tts(
        text="You are using a Voicy library. Please, give a star, if you like it.",
        voice={"en-US": "en-US-Wavenet-A"},
    )
)
This example will return File(path="84PFetz5IJdT4Je.wav", format="wav")

Simple STT example:

For using STT you only need to provide a language code. Format for it you can find in docs.

from voicy import Google

google = Google(token="token")

print(
    google.stt(
        file="84PFetz5IJdT4Je.wav",
        language_code="en-US",
    )
)
This example will return Transcript(text="You are using a Voicy library. Please, give a star, if you like it.", confidence=0.93750596, path="84PFetz5IJdT4Je.wav", format="wav")

Yandex Cloud:

For using Yandex TTS you don't need to provide any token. Just pass text, language code and voice model:

from voicy import Yandex

yandex = Yandex()

print(
    yandex.tts(
        text="You are using a Voicy library. Please, give a star, if you like it.",
        language_code="en-US",
        voice="ermil",
    )
)
This example will return File(path="SUypGpSLTvGKTTy.wav", format="wav")

License

The library is under the GNU LGPLv3 license.

BE AWARE THAT THE AUTHORS ARE UNDER NO CIRCUMSTANCES RESPONSIBLE FOR CONSEQUENCES OF USE AND ANY INTERACTION WITH THE LIBRARY. NOT LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE CODE IS PROVIDED FOR EDUCATION PURPOSES ONLY.

Read the LICENSE for more information.

Contributing

Feel free to contribute.

voicy's People

Contributors

aiexz avatar feschenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

urosch

voicy's 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.