Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(script_files
scripts/termux-api-start
scripts/termux-api-stop
scripts/termux-audio-info
scripts/termux-audio-sco
scripts/termux-battery-status
scripts/termux-brightness
scripts/termux-call-log
Expand Down
49 changes: 49 additions & 0 deletions scripts/termux-audio-sco.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!@TERMUX_PREFIX@/bin/bash
set -e -u

SCRIPTNAME=termux-audio-sco

show_usage () {
echo "Usage: $SCRIPTNAME [command]"
echo "Manage Bluetooth SCO audio channel for microphone capture."
echo
echo "Commands:"
echo " enable Activate SCO channel and switch to IN_COMMUNICATION mode"
echo " disable Deactivate SCO channel and restore audio mode"
echo " (none) Show current SCO state as JSON"
echo
echo "After 'enable', use termux-microphone-record -s 7 to record from Bluetooth microphone."
echo "Note: SCO audio quality is limited to 8-16 kHz (telephone quality)."
exit 0
}

while getopts :h option
do
case "$option" in
h) show_usage;;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done
shift $((OPTIND-1))

if [ $# -gt 1 ]; then
echo "$SCRIPTNAME: too many arguments"
exit 1
fi

COMMAND="${1:-}"

case "$COMMAND" in
enable|disable|"")
if [ -n "$COMMAND" ]; then
@TERMUX_PREFIX@/libexec/termux-api AudioSco --es command "$COMMAND"
else
@TERMUX_PREFIX@/libexec/termux-api AudioSco
fi
;;
*)
echo "$SCRIPTNAME: unknown command '$COMMAND'"
echo "Valid commands: enable, disable (or no argument for status)"
exit 1
;;
esac
9 changes: 8 additions & 1 deletion scripts/termux-microphone-record.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ show_usage () {
echo "-b <bitrate> Start recording w/ specified bitrate (in kbps)"
echo "-r <rate> Start recording w/ specified sampling rate (in Hz)"
echo "-c <count> Start recording w/ specified channel count (1, 2, ...)"
echo "-s <source> Start recording w/ specified audio source (integer constant):"
echo " 0=DEFAULT 1=MIC (default) 5=CAMCORDER"
echo " 6=VOICE_RECOGNITION 7=VOICE_COMMUNICATION (Bluetooth SCO)"
echo " 9=UNPROCESSED 10=VOICE_PERFORMANCE"
echo "-i Get info about current recording"
echo "-q Quits recording"
}
Expand Down Expand Up @@ -42,7 +46,7 @@ call_api () {
@TERMUX_PREFIX@/libexec/termux-api MicRecorder "$@"
}

while getopts h,f:,l:,e:,b:,r:,c:,d,i,q option
while getopts h,f:,l:,e:,b:,r:,c:,s:,d,i,q option
do
case "$option" in
h) sole "$@"
Expand Down Expand Up @@ -72,6 +76,9 @@ do
c) record=yes
add_params --ei channels $((OPTARG))
;;
s) record=yes
add_params --ei source $((OPTARG))
;;
i) sole "$@"
add_params -a info
;;
Expand Down