28 lines
768 B
Bash
Executable File
28 lines
768 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
recordingDir=~/Audio
|
|
mkdir -p "$recordingDir"
|
|
|
|
pidFile="/tmp/game_recording.pid"
|
|
|
|
if [[ -f "$pidFile" ]]; then
|
|
pid=$(cat "$pidFile")
|
|
if ps -p "$pid" > /dev/null 2>&1; then
|
|
kill "$pid"
|
|
spd-say -Cw "Recording stopped"
|
|
play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse
|
|
else
|
|
spd-say -Cw "Recording process not found, cleaning up"
|
|
fi
|
|
rm "$pidFile"
|
|
else
|
|
spd-say -Cw "Recording starting in"
|
|
for i in {3..1}; do
|
|
spd-say -Cw "$i"
|
|
sleep 0.5
|
|
done
|
|
play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20
|
|
ffmpeg -f pulse -i "$(pactl get-default-sink).monitor" "$recordingDir/game_$(date +%F_%H-%M-%S).ogg" &
|
|
echo "$!" > "$pidFile"
|
|
fi
|