4
GST_COMMAND="gst-launch audiotestsrc wave=sine freq=512 ! audioconvert ! audioresample ! gconfaudiosink"
5
#SOX_COMMAND="rec -q -r 44100 -p | sox -p $OUTPUT silence -l 1 00:00:00.5 -45d -1 00:00:00.5 -45d"
6
REC_COMMAND="rec -q -r 44100 $OUTPUT"
7
SOX_COMMAND="sox $OUTPUT $OUTPUT.1.wav silence -l 1 00:00:00.5 -45d -1 00:00:00.5 -45d"
9
# Start playing a sine wave
13
# Listen for it on the audio input
17
# Wait a bit, then stop playing
19
kill $REC_PID $GST_PID
24
# See if the filesize > 80 bytes on the output file
25
# (80 bytes is the largest wav file that will be generated for silence,
26
# so if we have that size we detected nothing but silence)
27
FILESIZE=`stat -c%s "$OUTPUT.1.wav"`
28
rm "$OUTPUT" "$OUTPUT.1.wav"
29
if [ "$FILESIZE" == "" ]
31
echo "Unable to find output file." >&2
35
if [ "$FILESIZE" -lt "81" ]
37
echo "No audio detected." >&2
40
echo "$FILESIZE bytes of audio recorded."