forked from Nachtzuster/BirdNET-Pi
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcustom_recording.sh
More file actions
executable file
·75 lines (63 loc) · 3.07 KB
/
custom_recording.sh
File metadata and controls
executable file
·75 lines (63 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -x
source /etc/birdnet/birdnet.conf
STAMP="%H:%M:%S"
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
if ! pulseaudio --check;then pulseaudio --start;fi
CUSTOM_WINDOW_START=(0 3 15 22)
CUSTOM_WINDOW_END=(0 7 19 23)
RECORDING_DURATION=60
PAUSE_DURATION=240
now=$(date +%H)
while [ $now -ge ${CUSTOM_WINDOW_START[0]} ] && [ $now -le ${CUSTOM_WINDOW_END[0]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[1]} ] && [ $now -le ${CUSTOM_WINDOW_END[1]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[2]} ] && [ $now -le ${CUSTOM_WINDOW_END[2]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done
while [ $now -ge ${CUSTOM_WINDOW_START[3]} ] && [ $now -le ${CUSTOM_WINDOW_END[3]} ];do
echo $now
# If you prefer no directory structure under "Raw", comment out the
# lines below and uncommend the commands at the bottom.
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
--use-strftime ${EXTRACTED}/Raw/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
# Uncomment the lines below if you'd prefer having no directory scructure
# under the "Raw" directory. Be sure to comment out the command above.
#arecord -f S16_LE -c${CHANNELS} -r48000 -t wav -d $RECORDING_DURATION \
# --use-strftime ${EXTRACTED}/Raw/%F-birdnet-${STAMP}.wav
sleep $PAUSE_DURATION
now=$(date +%H)
done