#!/bin/bash set -e export PATH="/tmp/ffmpeg-master-latest-linux64-gpl/bin:$PATH" WORKSPACE="/home/runner/.openclaw/workspace" OUTDIR="/tmp/tts_giselle" mkdir -p "$OUTDIR" rm -f "$OUTDIR"/*.ogg # Generate each chunk sequentially for i in 00 01 02 03 04 05 06 07 08 09; do chunk="/tmp/giselle_chunk_${i}.txt" echo "=== Starting chunk $i at $(date -u +%H:%M:%S) ===" echo "Chunk file: $chunk ($(wc -c < "$chunk") bytes)" # Read text, generate with voice.py cd "$WORKSPACE" python3 scripts/voice.py "$(cat "$chunk")" scarlett_johansson ogg # Find the newest generated file and move it with chunk index newest=$(ls -t /tmp/tts/voice_*.ogg | head -1) cp "$newest" "$OUTDIR/chunk_${i}.ogg" size=$(stat -c%s "$OUTDIR/chunk_${i}.ogg") echo "=== Finished chunk $i: ${size} bytes at $(date -u +%H:%M:%S) ===" # Small delay between chunks sleep 2 done echo "=== All chunks done, creating concat list ===" # Create ffmpeg concat file echo "" > /tmp/giselle_concat.txt for i in 00 01 02 03 04 05 06 07 08 09; do echo "file '${OUTDIR}/chunk_${i}.ogg'" >> /tmp/giselle_concat.txt done echo "=== Concatenating ===" ffmpeg -y -f concat -safe 0 -i /tmp/giselle_concat.txt -c copy /tmp/giselle_60min_scarjo.ogg 2>&1 | tail -5 echo "=== Final file ===" ls -lh /tmp/giselle_60min_scarjo.ogg echo "=== DONE ==="