Android Question Google cloud TTS

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:

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.
 
Upvote 0

Shivito1

Active Member
Licensed User
I see that they offer a REST API. You should use OkHttpUtils2 to access it.
so with OkHttpUtils2 I can use curl

B4X:
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"
 
Upvote 0
Top