desbma / GoogleSpeech

Read text using Google Translate TTS API
GNU Lesser General Public License v2.1
161 stars 37 forks source link

Regarding saving of audio #14

Closed saurabhvyas closed 6 years ago

saurabhvyas commented 6 years ago

Is there any way of saving the audio file on my linux computer ?

desbma commented 6 years ago

See here: https://github.com/desbma/GoogleSpeech/issues/3

Saving audio is not really supported, but you can still do it either by:

piegamesde commented 6 years ago

Is there a possibility to dump the audio to stdout instead? espeak does this and it is great.

desbma commented 6 years ago

It it not currently possible, because the audio is made from several audio files for short segments. So one would have to merge them (without transcoding) and output them at the same time, while also handling the text input that can come from stdin.

piegamesde commented 6 years ago

What about a command line parameter where google_speech does not play any sound, but outputs all files it would play to stdout (and nothing else)?

desbma commented 6 years ago

That would generate invalid audio data and no player would be able to read past the first file.

Concatenating 2 valid audio files does not necessarily result in a valid audio file, in fact for MP3 it is guaranteed to result in a corrupt file. Only certain specific transport formats like MPEG-TS are designed with that propriety in mind, because they are used when broadcasting streams where packet loss is common, and clients can start reading the stream at any random point.