I would like to be able to save the audio from the sample from Google’s cloud-based text-to-speed service. Is it possible to do this?
7 Answers
If you're going to do a lot of this, you should really use the API that they offer, but here's a quick step by step if you just want to download a single sample of Google's speech synthesis.
- Go to the page in Google Chrome.
- Open the Developer Tools (by pushing F12)
- Go to the "Network" tab.
- Enter the text you want to get audio of.
- Click the "SPEAK IT" button.
- Watch the "Network" tab populate with a couple of entries.
- Right-click the entry that starts with
data:audio/wav;base64,
and click "Open in new tab". - In the new tab, right-click the audio player, and click "Save video as..."
- Choose where you want to save the resulting
.wav
file.
Note: This will get you a (marginally) cleaner copy of the audio than recording the Stereo Mix from your sound card.
-
3Note: @wysiwyg's answer will continue to work even if Google changes things in order to make it so that this trick won't work anymore, and it is also useful for many other things where such tricks already don't work.– 3D1T0RCommented Aug 28, 2018 at 19:48
As predicted in this comment, the accepted answer is now broken. The basic approach still works though, except you have to save the proxy.json
and then decode the base64-encoded audio:
cat proxy.json | jq '.audioContent' -r | base64 -d > your-audio.wav
Edit: @3D1T0R 's answer is simpler and will most likely result in a higher quality file.
I would just use an audio recording program, such as Audacity, to record the "Stereo Mix" of your computer. You haven't specified an OS but assuming Windows:
First go to the Sound applet in the Control Panel, go to the
Recording
tab, right-clickStereo Mix
and selectEnable
. (If you don't seeStereo Mix
, checkShow disabled devices
)Then download/open Audacity, and in the Recording Device dropdown box, select
Stereo Mix
. Then just hit Record, and anything you hear playing out of your speakers will be recorded to a sound file.
-
1And for a Linux solution, see my answer here: superuser.com/a/1349602/926024– confettiCommented Aug 27, 2018 at 23:45
I wrote a browser extension specifically for this purpose: https://github.com/skygate2012/i_would_like_to_obtain_a_sample_plox
It uses the WebExtensions API to sniff HTTP responses and saves the wav audio when matched.
-
1This has been removed from the Firefox add-ons list, any chance it'll be added again?– GarbitCommented Oct 20, 2020 at 12:57
-
2@Garbit Not at the moment, I can't fix a bug that stopped working on the latest version of Firefox. If you can help PRs are welcome.– skygateCommented Oct 28, 2020 at 6:25
Here are the current steps
- Go to https://cloud.google.com/text-to-speech
- Open the Developer Tools (by F12)
- Go to the "Network" tab.
- Enter the text you want to get audio of.
- Click the "SPEAK IT" button.
- Click the “I’m not a robot” checkbox
- Watch the "Network" tab populate with a couple of entries.
- Right-click the entry that starts with proxy?url=https://texttospeech
- In the preview to right, click "copy" in the line for “audiocontent”
- Save this as a text file (base64.txt). Remove the quotes (") from beginning and end This contains the base64 encoded audio
- In Ubuntu, decode base64 to wav file with the following command:
- cat base64.txt | base64 --decode > audio.mp3
-
Just wanted to mention that under windows you can use in build command certutil -decode source-file destination.wav Commented Sep 3, 2022 at 22:18
In this video is it very well explained in Hindi/Urdu that how you can Covert Google TTS and Download as mp3: https://youtu.be/MFpCbjqoxII
-
1Please add further details to expand on your answer, such as working code or documentation citations.– Community BotCommented Sep 1, 2021 at 11:32
-
Welcome to Super User! Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.– DavidPostill ♦Commented Sep 1, 2021 at 12:03
-
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Commented Sep 1, 2021 at 13:49
Basically the same way. Inspect json response, take audiocontent base64 and decode to wav.
To make it easier for you, I made a chrome extension named audiotts. Just click SPEAK IT button and waiting the audio player come in. You can download the audio using download menu of the audio player.
https://youtu.be/vLFTUuoAxu4 feel free to check that 30seconds demo out 🤟