Hi Jeanette, List,
I've done this with sox and a bash script.
The script records from default audio device only when there is a sound
to record (i.e. exceeding a THRESHOLD). Each file is encoded as flac (in
order to not consume much disk space for very long runs) and the file
name contains some info such as a timestamp, an RMS value, ans some
other statistics.
I wrote the script, but some parts are taken from varius guide I've
found on the net, so I've not the credits for the original author(s).
Here is the script
#!/bin/bash
FORMAT=".flac"
DEVICE="default"
THRESHOLD="5%"
TMPFILE=tmp$FORMAT
echo $TMPFILE
while true; do
sox -t alsa $DEVICE $TMPFILE silence 1 0.1 5% 1 1.0 5%
DATE=$(date +%Y%m%d%H%M%S)
LEN=$(sox $TMPFILE -n stat 2>&1 | sed -n 's#^Length
(seconds):[^0-9]*\([0-9.]*\)$#\1#p')
MAX=$(sox $TMPFILE -n stat 2>&1 | sed -n 's#^Maximum
amplitude:[^0-9]*\([0-9.]*\)$#\1#p')
RMS=$(sox $TMPFILE -n stat 2>&1 | sed -n 's#^RMS
amplitude:[^0-9]*\([0-9.]*\)$#\1#p')
FREQ=$(sox $TMPFILE -n stat 2>&1 | sed -n 's#^Rough
frequency:[^0-9]*\([0-9.]*\)$#\1#p')
mv $TMPFILE $DATE$FORMAT
echo "[$DATE] $LEN, $MAX, $RMS, $FREQ" >> record1.log
done
On 07/11/2016 13:42, J. C. wrote:
Nov 7 2016, Peter P. has written:
...
I tried to record myself sleeping in order to
find out what I was
uttering. In my case I recorded the entire night, an approach which you
should do as well, and then strip silent parts from the recording in an
extra step.
Hey hey Peter,
that already is my approach, on the same grounds that you mention.
...
SoX has two effects, silence and vad (voice
activity detector) which can
possibly anaylze your recording.
Ah, I expected that SoX would be thrown in at
some point. Well, I'll
look into Sox and the other tools you mentioned. Thank you.
...
https://github.com/amsehili/auditok
The aubio toolkit on Debian offers two binaries:
aubioquiet - a command line tool to extracts quiet and loud regions
from a file
and
aubiocut - a command line tool to slice sound files at onset or beat
timestamps
...
Best wishes,
Jeanette
--------
When you need someone, you just turn around and I will be there <3
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user
--
a.