Skip to content

Instantly share code, notes, and snippets.

@Technifocal
Created October 5, 2017 13:40
Show Gist options
  • Save Technifocal/682f833af3efb1918a1bb20746c2678d to your computer and use it in GitHub Desktop.
Save Technifocal/682f833af3efb1918a1bb20746c2678d to your computer and use it in GitHub Desktop.
Parallelizes 'text.txt' to AWS Polly, splitting per sentence.
#!/usr/bin/env bash
cat text.txt | \
tr '\n' ' ' | \
sed -e 's/\(\s*[.\?]\)\s\?/\1\x00/g' | \
parallel -j64 --null 'aws polly synthesize-speech --output-format mp3 --text {1} --voice-id Amy Amy.$(printf "%010d" {#}).mp3' && \
ffmpeg -i 'concat:'$(for i in *.mp3; do echo -n "${i}|"; done) out.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment