Android Question Google cloud TTS

Discussion in 'Android Questions' started by Shivito1, Sep 14, 2018.

Tags:
  1. Shivito1

    Shivito1 Active Member Licensed User

    I got this working great in Python. My java skills are not good someone please look at this :Link: and give me suggestion to make this work in my b4A. Thanks :)

    I want to use Google cloud TTS. I have set up my free account but not sure how I hand text over to the cloud to read. https://cloud.google.com/text-to-speech/docs/quickstart-protocol
    If there is a thread on this I'm happy to read it myself but I just could not find any to read.
     
    Last edited: Sep 17, 2018
  2. Shivito1

    Shivito1 Active Member Licensed User

    could I use inline java? Also I don't want to create the MP3 file. I want to read the response data directly.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    I see that they offer a REST API. You should use OkHttpUtils2 to access it.
     
    Shivito1 likes this.
  4. Shivito1

    Shivito1 Active Member Licensed User

    so with OkHttpUtils2 I can use curl

    Code:
    curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) -H "Content-Type: application/json; charset=utf-8" --data "{
      'input':{
        'text':'I\'ve added the event to your calendar.'
      },
      'voice':{
        'languageCode':'en-gb',
        'name':'en-GB-Standard-A',
        'ssmlGender':'FEMALE'
      },
      'audioConfig':{
        'audioEncoding':'MP3'
      }
    }" "https://texttospeech.googleapis.com/v1/text:synthesize"
     
  5. Shivito1

    Shivito1 Active Member Licensed User

    sorry I found what you were talking about. I'll update if I get it working. Thanks Erel
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice