Skip to content

Commit

Permalink
fix MP3 recordings, other minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed May 22, 2024
1 parent a66e7d8 commit 0b3ea71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/noisecapt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if ! chk_enabled "$PF_ALSA_MANUAL"; then
amixer -q -c "$CARD" cset numid="$numid" "$maxvolume"
# Last - switch the AGC off as this will mess with the audio levels
numid="$(amixer --card "$CARD" contents|grep 'Auto Gain Control' | sed -n 's/numid=\([0-9]\+\).*/\1/p')"
amixer -q -c "$CARD" cset numid="$numid" off
if [[ -n "$numid" ]]; then amixer -q -c "$CARD" cset numid="$numid" off; fi
fi
fi
# -----------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions rootfs/usr/share/noisecapt/noisecapt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ while true; do
# All dB levels are dBFS, or dB where the loudest (="full scale") is 0 dB

if chk_enabled "$RECORD_MP3"; then
RMSREC="$(arecord -D hw:"$CARD,$DEVICE" -d 5 --fatal-errors --buffer-size=192000 -f dat -t raw -c 1 --quiet 2>/dev/null \
| tee >(lame --quiet -r --preset phone -s 48 -a - "${OUTFILE}recording-$(date -d @"$AUDIOTIME" +%y%m%d-%H%M%S).mp3" >/dev/null 2>&1) \
RMSREC="$(arecord -D hw:"$CARD,$DEVICE" -d "$CAPTURETIME" --fatal-errors --buffer-size=192000 -f dat -t raw -c 1 --quiet 2>/dev/null \
| tee >(lame --quiet -r --preset phone -s 48 - "${OUTFILE}recording-$(date -d @"$AUDIOTIME" +%y%m%d-%H%M%S).mp3" >/dev/null 2>&1) \
| sox -V -t raw -b 16 -r 48000 -c 1 -e signed-integer - -n sinc 200-10000 stats rate 16000 spectrogram -o "${OUTFILE}spectro-$(date -d @"$AUDIOTIME" +%y%m%d-%H%M%S).png" -Z -10 -z 60 -t "Audio Spectrogram for $(date -d @"$AUDIOTIME")" -c "PlaneFence (C) 2020-2024 by kx1t" -p 1 2>&1 \
| grep 'RMS lev dB')"
else
RMSREC="$(arecord -D hw:"$CARD,$DEVICE" -d 5 --fatal-errors --buffer-size=192000 -f dat -t raw -c 1 --quiet 2>/dev/null \
RMSREC="$(arecord -D hw:"$CARD,$DEVICE" -d "$CAPTURETIME" --fatal-errors --buffer-size=192000 -f dat -t raw -c 1 --quiet 2>/dev/null \
| sox -V -t raw -b 16 -r 48000 -c 1 -e signed-integer - -n sinc 200-10000 stats rate 16000 spectrogram -o "${OUTFILE}spectro-$(date -d @"$AUDIOTIME" +%y%m%d-%H%M%S).png" -Z -10 -z 60 -t "Audio Spectrogram for $(date -d @"$AUDIOTIME")" -c "PlaneFence (C) 2020-2024 by kx1t" -p 1 2>&1 \
| grep 'RMS lev dB')"
fi
Expand Down

0 comments on commit 0b3ea71

Please sign in to comment.