$ cat node-template.py
V
Voice Conversion
// Converts speech from one voice to another. Provide a source audio clip and a target voice reference to produce the same speech in the target voice.
Process
Audio
template.py
1import os2import sys3import json4import traceback56from gais import Gais78INPUT_DIR = "/data/input"9OUTPUT_DIR = "/data/output"101112def main():13 try:14 input_json = sys.stdin.read()15 execution_input = json.loads(input_json)16 inputs = execution_input.get("inputs", {})1718 source_audio = inputs.get("source_audio", "")19 narrator_voice = inputs.get("narrator_voice", "")2021 if not source_audio:22 raise ValueError("Source audio input is required")23 if not narrator_voice:24 raise ValueError("Narrator voice input is required")2526 source_path = os.path.join(INPUT_DIR, source_audio)27 if not os.path.exists(source_path):28 raise FileNotFoundError(f"Source audio not found: {source_path}")2930 narrator_path = os.path.join(INPUT_DIR, narrator_voice)31 if not os.path.exists(narrator_path):32 raise FileNotFoundError(f"Narrator voice not found: {narrator_path}")3334 os.makedirs(OUTPUT_DIR, exist_ok=True)3536 print("Requesting voice conversion...", file=sys.stderr)3738 result = Gais.speech.convert(39 source_audio=source_path,40 narrator_voice=narrator_path,41 )4243 # Save result44 out_filename = "converted_speech.mp3"45 out_path = os.path.join(OUTPUT_DIR, out_filename)46 with open(out_path, "wb") as f:47 f.write(result.content)4849 inference_time = result.metadata.get("inference_time_ms", "unknown")50 print(51 f"Voice converted: time={inference_time}ms",52 file=sys.stderr,53 )5455 # Flat output - keys match OUTPUT_SCHEMA56 output = {57 "audio": out_filename,58 }59 print(json.dumps(output, indent=2))6061 except Exception as e:62 error_output = {63 "error": str(e),64 "errorType": type(e).__name__,65 "traceback": traceback.format_exc(),66 }67 print(json.dumps(error_output), file=sys.stderr)68 sys.exit(1)697071if __name__ == "__main__":72 main()$ git log --oneline
v1.5.0
HEAD
2026-05-07v1.2.02026-04-09