Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

voicy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

voicy

Wrapper for free use Google cloud TTS.

  • 0.4.2
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc