Skip to content

Commit 6f97878

Browse files
committed
termux-microphone-record: companion PR for termux-api/#248
1 parent edf994c commit 6f97878

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

scripts/termux-microphone-record

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ show_usage () {
1010
echo "-h Shows this help"
1111
echo "-d Start recording w/ defaults"
1212
echo "-f <file> Start recording to specific file"
13-
echo "-l <limit> Start recording w/ specified limit (in seconds)"
13+
echo "-l <limit> Start recording w/ specified limit (in seconds, unlimited for 0)"
14+
echo "-e <encoder> Start recording w/ specified encoder (aac, amr_wb, amr_nb)"
15+
echo "-b <bitrate> Start recording w/ specified bitrate (in kbps)"
16+
echo "-r <rate> Start recording w/ specified sampling rate (in Hz)"
17+
echo "-c <count> Start recording w/ specified channel count (1, 2, ...)"
1418
echo "-i Get info about current recording"
1519
echo "-q Quits recording"
1620
}
@@ -38,7 +42,7 @@ call_api () {
3842
/data/data/com.termux/files/usr/libexec/termux-api MicRecorder "$@"
3943
}
4044

41-
while getopts h,f:,l:,d,i,q option
45+
while getopts h,f:,l:,e:,b:,r:,c:,d,i,q option
4246
do
4347
case "$option" in
4448
h) sole "$@"
@@ -55,6 +59,19 @@ do
5559
;;
5660
d) record=yes
5761
;;
62+
e) record=yes
63+
add_params --es encoder "$OPTARG"
64+
;;
65+
# API takes bitrate in bps
66+
b) record=yes
67+
add_params --ei bitrate $((OPTARG * 1000))
68+
;;
69+
r) record=yes
70+
add_params --ei srate $((OPTARG))
71+
;;
72+
c) record=yes
73+
add_params --ei channels $((OPTARG))
74+
;;
5875
i) sole "$@"
5976
add_params -a info
6077
;;

0 commit comments

Comments
 (0)