Im using hume.ai for TTS. I got the response back in a json file with base64 output.I can’t figure out how to extract it because I cant get the right expression to work. None of the expressions I use work so I cant get to the data nor can any of the LLMs I use (ChatGPT, Gemini, Claude, Manus). This expression does not work {{ $json.generations[0].audio }}
it doesnt correspond to anything in the previous output. I did it in python on colab and it works, that should be the structure but there is something on n8n that might be changing it.
to answer your original question, if order to turn base64 string to mp3 file, you could use “Convert to file” node. For example:
I am using a local mp3 file, which I send to an API to turn to base64, so the response coming from the http request node is base64 encoded mp3 (you obviously don’t need to do this dance, you already have your b64), then I convert it to a file and transcribe with open ai.
In n8n, to extract the Base64 audio string from the generations array, use the expression {{ $json["generations"][0]["audio"] }} inside a Set or Function node. If you’re referencing a previous node like an HTTP Request, use {{ $node["HTTP Request"].json["generations"][0]["audio"] }} instead. Just ensure the node name matches exactly. This will give you the correct audio value from the response.