Difficulty Generating and Saving Audio from Gemini TTS API (or Cloud TTS) with Convert to PCM File

Problem Description

Hello, Community!
I’m trying to create a workflow to generate audio from text using Google’s Speech Generation API (Gemini TTS / Cloud Text-to-Speech) and save the audio locally. I’ve made a lot of progress, but I’m stuck at the stage of processing the audio returned by the API.
My goal: Get text, send it to Google’s TTS API, receive the audio (Base64) and save it as an .mp3 file locally.
Current workflow (summarized): Start → Read .txt → Extract Text → Code (Split Text into Snippets) → Loop → HTTP Request (Calls TTS API) → Convert to PCM File (HERE’S THE PROBLEM) → Read/Write Files (Saves .pcm) → Execute Command (FFmpeg to .mp3).

The Convert to PCM File node is failing with the error “Operation not permitted, make sure you have the correct permissions” or something like TypeError: Cannot read properties of undefined (reading ‘data’).
My observations and what I’ve tried:

  1. HTTP Request API:
    o The API is receiving the request and does not return a 400/403 error when the text is sent verbatim.
    o The URL being used is https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-tts:streamGenerateContent.
    o Authentication is via X-Goog-Api-Key in the header.
  2. The Convert to PCM File node:
    o Expects binary data in a specific field (configured as candidates[0].content.parts[0].inlineData or variations like data).
    o The “Operation not permitted” error suggests that the input data for conversion may be missing, invalid, or the node does not have permission to the temporary directory.
    o I have already tried specifying the full output path (D:\Files\Script\Narration\out_put_excerpt_X.pcm) and checking permissions.

Error message

error_node_id: '5',
webhook_domain: null,
sharing_role: 'owner',
credential_type: null,
is_managed: false,
eval_rows_left: null,
instance_id: 'ace52b8e95ec3941fe529997779d46984877a3f656abdf3627f580bf7b404e6b',
version_cli: '1.100.1'

},
context: { ip: ‘0.0.0.0’ }
}
2025-07-08T13:06:55.304Z [Rudder] info: Your message must be < 32kb. This is currently surfaced as a warning. Please update your code {
userId: ‘ace52b8e95ec3941fe529997779d46984877a3f656abdf3627f580bf7b404e6b#cab74c88-5076-4258-96e3-4f4d65e0cf6f’,
event: ‘Workflow execution errored’,
properties: {
workflow_id: ‘ra3KvsJimF3asKYH’,
is_manual: true,
version_cli: ‘1.100.1’,
success: false,
user_id: ‘cab74c88-5076-4258-96e3-4f4d65e0cf6f’,
execution_mode: ‘manual’,
error_message: 'The value in “…”
… 1785290 more characters,
error_node_type: ‘n8n-nodes-base.convertToFile’,
node_graph: {
node_types: [Array],
node_connections: [Array],
nodes: [Object],
notes: {},
is_pinned: false
},
node_graph_string:
error_node_id: ‘5’,
instance_id: ‘ace52b8e95ec3941fe529997779d46984877a3f656abdf3627f580bf7b404e6b’
},
context: { ip: ‘0.0.0.0’ }

My workflow

Share the output returned by the last node

NodeOperationError: The value in "8P/4/wIA///9/wIABwAGAPr/7//i/8//w/...

Information on your n8n setup

  • n8n version: 1.100.1 (Self Hosted)
  • Database (default: SQLite): I don’t use
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n: npm
  • Operating system: Windows 10

HI Leonardo_D_Silva,
The problem is with Base64 Input Field in your Convert to PCM File node. It expects literally a field name, and not an expression that returns a base64 string.
Hope this helps

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.