google-translate-tts
google-translate-tts copied to clipboard
Discord bot toBuffer error
Been getting this error all of a sudden. Worked just fine up until a couple days ago, nothing changed on my end code-wise.
Error: Unable to parse audio data. Check your request params. at toBuffer (/home/runner/#PROJECTNAME#/node_modules/google-translate-tts/src/synthesize.js:65:13)
Me too.
I did some testing, looks like google removed the ability to use the different voice variants and now you're stuck using generic ones. "en" instead of "en-US" etc. They also changed the request format a tiny bit, I changed: https://github.com/ncpierson/google-translate-tts/blob/639193e9cef2417e11a1a0937515eedce8fa11d0/src/synthesize.js#L14-L15 To:
const values = JSON.stringify([text, voice, slow ? true : null]);
const data = JSON.stringify([[["jQ1olc", values, null]]]);
Maybe someone else can figure out a way to get the voice variants to work
I trust you that the variants aren't working anymore, but I doubt they're gone completely. My guess is that they exist as a separate parameter now. I'll have to look into this later.
Thanks for finding the solution @Godlikehobbit