简体   繁体   中英

Using Google cloud platform to convert speech to text

I am trying to create app for speech to text.
With the following JSON code I get results back:

        {
"config": {
            "encoding":"FLAC",
            "sampleRateHertz": 16000,
            "languageCode": "en-US",
            "enableWordTimeOffsets": false 
             }, 
    "audio": {"uri":"gs://cloud-samples-tests/speech/brooklyn.flac"  }
    }

I am using EncdDecd unit for EncodeFile function. The problem is when I am trying to pass my audio file as Base64 string with the following code:

        {
"config": {
            "encoding":"FLAC",
            "sampleRateHertz": 16000,
            "languageCode": "en-US",
            "enableWordTimeOffsets": false 
             }, 
    "audio": {
"content":"'+EncodeFile(myaudio_flac_filename)+'"  }
    }

What is the function to convert a WAV file to Base64 string?

Check out this answer: Binary to Base64 (Delphi)

If that doesn't work for some reason, let us know what version of Delphi you are on and what errors you are running into.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM