Skip to content

Instantly share code, notes, and snippets.

@unascribed
Last active March 14, 2017 23:16
Show Gist options
  • Save unascribed/f656b7d5debb40957db171d13b90865d to your computer and use it in GitHub Desktop.
Save unascribed/f656b7d5debb40957db171d13b90865d to your computer and use it in GitHub Desktop.
#!/bin/bash
fifo=/tmp/$RANDOM$RANDOM.raw
temp1=/tmp/$RANDOM$RANDOM.1.wav
temp2=/tmp/$RANDOM$RANDOM.2.wav
display=1
while [ -e /tmp/.X${display}-lock ]; do
display=`expr $display + 1`
done
Xvfb :$display -ac -screen 0 832x588x24 &
xvfb=$!
export DISPLAY=:$display
mkfifo $fifo
SDL_AUDIODRIVER=disk SDL_DISKAUDIOFILE=$fifo hatari --cpuclock 32 --cpu-exact false --memsize 0 --fastfdc true --confirm-quit false --mousewarp false --conout 2 --log-file /dev/null --fast-boot true /home/aesen/gemdos/STSPEECH.TOS &
hatari=$!
(
sleep 2
xdotool type "$1"
sleep 4
xdotool key Return
) &
ffmpeg -ss 5 -f s16le -ar 44100 -ac 2 -i $fifo -y $temp1 &
ffmpeg=$!
sleep 10
kill $hatari
wait $ffmpeg
kill $xvfb
ffmpeg -i $temp1 -af silenceremove=1:0:-50dB -y $temp2
ffmpeg -i $temp2 -af areverse -y $temp1
ffmpeg -i $temp1 -af silenceremove=1:0:-50dB -y $temp2
ffmpeg -i $temp2 -af areverse -y "$2"
rm $fifo $temp1 $temp2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment