Using WaveNet with Google Cloud API

Source: Internet
Author: User

WaveNet is used in Cloud text-to-speech for TTS, which has a demo on the page. Currently a beta version

How to use
    • Registration and Certification reference: Quickstart:text-to-speech
    • Install the Python library for Google Clould
    • Install Google Cloud Text-to-Speech API Python dependency (Dependencies), see GitHub instructions
    • ----included, install PIP install google-cloud-texttospeech==0.1.0

To implicit the call, set the environment variable google_application_credentials to your API Key (JSON file) and reboot after completion

Python script: Text to mp3

# [START tts_synthesize_text]def Synthesize_text (text): "" "" "    synthesizes speech from the input string of text.    " "" From Google.cloud import texttospeech    client = Texttospeech. Texttospeechclient ()    input_text = Texttospeech.types.SynthesisInput (text=text)    # note:the voice can also be specified by name.    # Names of voices can is retrieved with Client.list_voices ().    Voice = Texttospeech.types.VoiceSelectionParams (        language_code= ' en-us ',        ssml_gender= Texttospeech.enums.SsmlVoiceGender.FEMALE)    audio_config = Texttospeech.types.AudioConfig (        audio_ Encoding=texttospeech.enums.audioencoding.mp3)    response = Client.synthesize_speech (Input_text, voice, Audio_ config)    # The response ' s audio_content is binary.    With open (' Output.mp3 ', ' WB ') as Out:        out.write (response.audio_content)        print (' audio content written to file "Output.mp3" ') # [END Tts_synthesize_text]

  

WaveNet characteristics

6 Types of voice type currently supported

Parameter description

Https://cloud.google.com/text-to-speech/docs/reference/rest/v1beta1/text/synthesize#audioconfig

    • Input_text

    • Voice

    • Audio_config

Using WaveNet with Google Cloud API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.