| 123456789101112131415161718 |
- #!/bin/bash
- #from https://unix.stackexchange.com/questions/685390/detecting-sound-silence-on-a-sox-pipe
- # Get your PulseAudio source monitor (edit regex to suit you)
- pulse_monitor=$(pactl list short sources | awk '$1 = /alsa.*monitor/ {print $2}')
- function wait_for_audio() {
- parec --rate 1000 -d $pulse_monitor 2>/dev/null \
- | LC_ALL=C fgrep -qm 1 .
- }
- while [ true ]; do
- wait_for_audio
- echo "Sound Detected starting @ $(date)" >> $log
- sleep 2
- exit
- done
|