aispeech: add 4mic sdk
Change-Id: Ifa01cfeb8921e99051a8595687498b7a8019b517 Signed-off-by: Sun ChuanHu <aaron.sun@rock-chips.com>
This commit is contained in:
48
rk3308/aispeech-4mic-32bit/RkLunch.sh
Executable file
48
rk3308/aispeech-4mic-32bit/RkLunch.sh
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
arecord -D vad -c 8 -r 16000 -f S16_LE -d 1 -t raw /tmp/test.pcm
|
||||||
|
rm /tmp/test.pcm
|
||||||
|
echo 0x60 0x40ff0050 > /sys/kernel/debug/vad/reg
|
||||||
|
echo 0x5c 0x000e2080 > /sys/kernel/debug/vad/reg
|
||||||
|
|
||||||
|
ln -s /oem/aispeech_softap_lite /data/aispeech_softap_lite
|
||||||
|
ln -s /oem/wifi_monitor.sh /data/
|
||||||
|
ln -s /oem/dds_client /data/dds_client
|
||||||
|
ln -s /oem/dds_service.sh /data/
|
||||||
|
|
||||||
|
export AISPEECH_WIFI_CFG="/data/wpa_supplicant.conf"
|
||||||
|
|
||||||
|
#aispeech dui app information file
|
||||||
|
export AISPEECH_DUIKIT_APP="/data/aispeech_softap_lite/device/app.json"
|
||||||
|
|
||||||
|
#aispeech dui device file
|
||||||
|
export AISPEECH_DUIKIT_DEVICE="/data/aispeech_softap_lite/device/device.json"
|
||||||
|
|
||||||
|
#aispeech dui softap web server address
|
||||||
|
export AISPEECH_SOFTAP_SERVER_PORT="8000"
|
||||||
|
|
||||||
|
#aispeech dui softap configuration folder
|
||||||
|
export AISPEECH_SOFTAP_DIR="/data/cfg"
|
||||||
|
|
||||||
|
export AISPEECH_DO_CONNECT_MP3="/data/aispeech_softap_lite/audio/do_connect.mp3"
|
||||||
|
|
||||||
|
export AISPEECH_WIFI_OK_MP3="/data/aispeech_softap_lite/audio/wifi_ok.mp3"
|
||||||
|
|
||||||
|
export AISPEECH_NEED_CONNECT_MP3="/data/aispeech_softap_lite/audio/need_connect.mp3"
|
||||||
|
|
||||||
|
export AISPEECH_CONNECT_OK_MP3="/data/aispeech_softap_lite/audio/connect_ok.mp3"
|
||||||
|
|
||||||
|
export AISPEECH_START_CONNECT_MP3="/data/aispeech_softap_lite/audio/start_connect.mp3"
|
||||||
|
|
||||||
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/userdata:/userdata/bin:/data/bin:/data/bin/rk_pcba_test:/data/aispeech_softap_lite/bin
|
||||||
|
|
||||||
|
if [ -f ${AISPEECH_WIFI_CFG} ]; then
|
||||||
|
#aispeech_player ${AISPEECH_WIFI_OK_MP3}
|
||||||
|
wpa_supplicant -B -i wlan0 -c ${AISPEECH_WIFI_CFG} &
|
||||||
|
dhcpcd &
|
||||||
|
aispeech_player ${AISPEECH_DO_CONNECT_MP3}
|
||||||
|
else
|
||||||
|
aispeech_player ${AISPEECH_NEED_CONNECT_MP3} &
|
||||||
|
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||||
|
fi
|
||||||
|
aispeech_startup &
|
||||||
|
/data/wifi_monitor.sh &
|
||||||
|
amixer cset name='Master Playback Volume' 90%
|
||||||
24
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/README
Executable file
24
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/README
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
一、需要设置的环境变量,如果不设置使用默认值
|
||||||
|
|
||||||
|
//app发送的元数据,写入此文件
|
||||||
|
export AISPEECH_DUIKIT_APP="/data/cfg/app.json"
|
||||||
|
|
||||||
|
//device元数据,app获取此信息
|
||||||
|
export AISPEECH_DUIKIT_DEVICE="/data/cfg/device.json"
|
||||||
|
|
||||||
|
//配网文件
|
||||||
|
export AISPEECH_WIFI_CFG="/data/cfg/wpa_supplicant.conf"
|
||||||
|
|
||||||
|
//服务器端口号
|
||||||
|
export AISPEECH_SOFTAP_SERVER_PORT="8000"
|
||||||
|
|
||||||
|
//设备成功获取ssid和password信息,开始联网时,播放的音频
|
||||||
|
export AISPEECH_DO_CONNECT_MP3="/data/cfg/audio/do_connect.mp3"
|
||||||
|
|
||||||
|
二、命令操作
|
||||||
|
1.将aispeech_softap、aispeech_led命令的路径导出
|
||||||
|
例如上述两个命令在目录/data/cfg/bin,需要进行如下操作
|
||||||
|
export PATH=$PATH:/data/cfg/bin
|
||||||
|
|
||||||
|
开启服务器:
|
||||||
|
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||||
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/connect_ok.mp3
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/connect_ok.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/do_connect.mp3
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/do_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/need_connect.mp3
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/need_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/start_connect.mp3
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/start_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/wifi_ok.mp3
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/audio/wifi_ok.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_player
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_player
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_softap
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_softap
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_softap_server
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_softap_server
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_startup
Executable file
BIN
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/bin/aispeech_startup
Executable file
Binary file not shown.
1
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/device/app.json
Executable file
1
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/device/app.json
Executable file
@ -0,0 +1 @@
|
|||||||
|
{"name":"hahahaha"}
|
||||||
11
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/device/device.json
Executable file
11
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/device/device.json
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"deviceType":"soundbox",
|
||||||
|
"deviceName":"aispeech-rk3308-0001",
|
||||||
|
"deviceAlias":"aispeech-rk3308-0001alias",
|
||||||
|
"productId":"12345678",
|
||||||
|
"deviceInfo": {
|
||||||
|
"platform":"linux",
|
||||||
|
"wifiMac":"12:23:ee:11:23",
|
||||||
|
"btMac":"12:23:ee:11:23"
|
||||||
|
}
|
||||||
|
}
|
||||||
59
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/install_v11.sh
Executable file
59
rk3308/aispeech-4mic-32bit/aispeech_softap_lite/install_v11.sh
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#this script is used for rk3308 V11 board
|
||||||
|
|
||||||
|
dir=`pwd`
|
||||||
|
|
||||||
|
for item in `ls bin`; do
|
||||||
|
chmod +x ${dir}/bin/${item}
|
||||||
|
done
|
||||||
|
|
||||||
|
#hardware-related configuration
|
||||||
|
board_startup_script=/oem/RkLunch.sh
|
||||||
|
|
||||||
|
rm -rf ${board_startup_script}
|
||||||
|
|
||||||
|
#wpa configuration file
|
||||||
|
aispeech_wifi_cfg=/data/wpa_supplicant.conf
|
||||||
|
|
||||||
|
rm -rf ${aispeech_wifi_cfg}
|
||||||
|
|
||||||
|
content="export AISPEECH_WIFI_CFG=\"${aispeech_wifi_cfg}\"
|
||||||
|
|
||||||
|
#aispeech dui app information file
|
||||||
|
export AISPEECH_DUIKIT_APP=\"${dir}/device/app.json\"
|
||||||
|
|
||||||
|
#aispeech dui device file
|
||||||
|
export AISPEECH_DUIKIT_DEVICE=\"${dir}/device/device.json\"
|
||||||
|
|
||||||
|
#aispeech dui softap web server address
|
||||||
|
export AISPEECH_SOFTAP_SERVER_PORT=\"8000\"
|
||||||
|
|
||||||
|
#aispeech dui softap configuration folder
|
||||||
|
export AISPEECH_SOFTAP_DIR=\"/data/cfg\"
|
||||||
|
|
||||||
|
export AISPEECH_DO_CONNECT_MP3=\"${dir}/audio/do_connect.mp3\"
|
||||||
|
|
||||||
|
export AISPEECH_WIFI_OK_MP3=\"${dir}/audio/wifi_ok.mp3\"
|
||||||
|
|
||||||
|
export AISPEECH_NEED_CONNECT_MP3=\"${dir}/audio/need_connect.mp3\"
|
||||||
|
|
||||||
|
export AISPEECH_CONNECT_OK_MP3=\"${dir}/audio/connect_ok.mp3\"
|
||||||
|
|
||||||
|
export AISPEECH_START_CONNECT_MP3=\"${dir}/audio/start_connect.mp3\"
|
||||||
|
|
||||||
|
export PATH=${PATH}:${dir}/bin
|
||||||
|
|
||||||
|
if [ -f \${AISPEECH_WIFI_CFG} ]; then
|
||||||
|
aispeech_player \${AISPEECH_WIFI_OK_MP3}
|
||||||
|
wpa_supplicant -B -i wlan0 -c \${AISPEECH_WIFI_CFG} &
|
||||||
|
dhcpcd &
|
||||||
|
aispeech_player \${AISPEECH_DO_CONNECT_MP3}
|
||||||
|
else
|
||||||
|
aispeech_player \${AISPEECH_NEED_CONNECT_MP3} &
|
||||||
|
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||||
|
fi
|
||||||
|
aispeech_startup &
|
||||||
|
"
|
||||||
|
echo "${content}" > ${board_startup_script}
|
||||||
|
|
||||||
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/audio/wakeup.mp3
Normal file
BIN
rk3308/aispeech-4mic-32bit/dds_client/audio/wakeup.mp3
Normal file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/dui
Executable file
BIN
rk3308/aispeech-4mic-32bit/dds_client/dui
Executable file
Binary file not shown.
39
rk3308/aispeech-4mic-32bit/dds_client/dui_cfg.json
Normal file
39
rk3308/aispeech-4mic-32bit/dds_client/dui_cfg.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"auth":{
|
||||||
|
"productId": "100001463",
|
||||||
|
"deviceProfile": "Yhn7W3QzXThMGBG1qgJcbCmW0hmO7HYdHcfuQPFzJhgnzWrrJhPPWYTdm5qJlpyarJqcjZqL3cXdz8fKm5nNycyZmcbGy5udy52cy8bHzsuZzJ6ZmZrLzMnd092ek5OQiN3FztPdj42Qm4qci7ab3cXdzs/Pz8/Oy8nM3dPdm5qJlpyasZ6Smt3F3Z7Oy8icnpmbms6bnsvNm87Gz83MnsqZzcicy83Iy5rN3dPdjJyQj5rdxaTdnpOT3aKC"
|
||||||
|
},
|
||||||
|
"recorder":{
|
||||||
|
"device":"4mic_loopback",
|
||||||
|
"bits":16,
|
||||||
|
"channels":5,
|
||||||
|
"samplerate":16000
|
||||||
|
},
|
||||||
|
"player":{
|
||||||
|
"device":"default"
|
||||||
|
},
|
||||||
|
"wakeup":{
|
||||||
|
"cfg":{
|
||||||
|
"aecBinPath":"./res/AEC_ch5-2-1ref_common_20180727_v0.9.4.bin",
|
||||||
|
"wakeupBinPath":"./res/wakeup_aifar_comm_20180104.bin",
|
||||||
|
"beamformingBinPath":"./res/UCA_asr_ch4-2-ch4_70mm_comm_20180412_v1.2.1.bin",
|
||||||
|
"env":"words=ni hao xiao le;thresh=0.34;major=1;",
|
||||||
|
"rollBack":200
|
||||||
|
},
|
||||||
|
"wakeupWord":["ni hao xiao le"],
|
||||||
|
"wakeupAudio":["./audio/wakeup.mp3"]
|
||||||
|
},
|
||||||
|
"vad":{
|
||||||
|
"cfg":{
|
||||||
|
"resBinPath":"./res/vad_aihome_v0.7.bin",
|
||||||
|
"pauseTime":300
|
||||||
|
},
|
||||||
|
"startTimeoutPrompt":"./audio/vad_start_timeout2.mp3"
|
||||||
|
},
|
||||||
|
"dds":{
|
||||||
|
"productId":"100001463",
|
||||||
|
"aliasKey":"prod",
|
||||||
|
"server":"ws://dds.dui.ai/dds/v1",
|
||||||
|
"deviceProfile":"Yhn7W3QzXThMGBG1qgJcbCmW0hmO7HYdHcfuQPFzJhgnzWrrJhPPWYTdm5qJlpyarJqcjZqL3cXdz8fKm5nNycyZmcbGy5udy52cy8bHzsuZzJ6ZmZrLzMnd092ek5OQiN3FztPdj42Qm4qci7ab3cXdzs/Pz8/Oy8nM3dPdm5qJlpyasZ6Smt3F3Z7Oy8icnpmbms6bnsvNm87Gz83MnsqZzcicy83Iy5rN3dPdjJyQj5rdxaTdnpOT3aKC"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libauth_rk3308.so
Executable file
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libauth_rk3308.so
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libdds.so
Executable file
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libdds.so
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libdemo_depend.so
Executable file
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libdemo_depend.so
Executable file
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libduilite_fespa.so
Executable file
BIN
rk3308/aispeech-4mic-32bit/dds_client/lib/rk3308_32/libduilite_fespa.so
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
rk3308/aispeech-4mic-32bit/dds_client/res/vad_aihome_v0.7.bin
Normal file
BIN
rk3308/aispeech-4mic-32bit/dds_client/res/vad_aihome_v0.7.bin
Normal file
Binary file not shown.
Binary file not shown.
23
rk3308/aispeech-4mic-32bit/dds_service.sh
Executable file
23
rk3308/aispeech-4mic-32bit/dds_service.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo "Starting $0..."
|
||||||
|
cd /oem/dds_client && ./dui dui_cfg.json &
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo "Stop $0..."
|
||||||
|
killall dui
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
killall dui
|
||||||
|
cd /oem/dds_client && ./dui dui_cfg.json &
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
||||||
93
rk3308/aispeech-4mic-32bit/wifi_monitor.sh
Executable file
93
rk3308/aispeech-4mic-32bit/wifi_monitor.sh
Executable file
@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PROCESS=/data/dds_service.sh
|
||||||
|
|
||||||
|
softap_stop()
|
||||||
|
{
|
||||||
|
echo softap_stoping
|
||||||
|
|
||||||
|
killall dui || echo dui-exit
|
||||||
|
ip addr delete 192.168.1.1 dev p2p0 || echo ip-addr-delete
|
||||||
|
killall hostapd || echo hostapd-exit
|
||||||
|
ifconfig p2p0 down || echo p2p0
|
||||||
|
|
||||||
|
echo softap_stopped
|
||||||
|
}
|
||||||
|
|
||||||
|
dds_start()
|
||||||
|
{
|
||||||
|
softap_stop
|
||||||
|
#echo dds_start
|
||||||
|
pidof dui || $PROCESS start
|
||||||
|
|
||||||
|
gst-play-1.0 /data/aispeech_softap_lite/audio/connect_ok.mp3
|
||||||
|
}
|
||||||
|
|
||||||
|
dds_stop()
|
||||||
|
{
|
||||||
|
echo dds_stop
|
||||||
|
#$PROCESS stop
|
||||||
|
}
|
||||||
|
wifiReadyAction()
|
||||||
|
{
|
||||||
|
pidof dui || $PROCESS start
|
||||||
|
}
|
||||||
|
wifiUpAction()
|
||||||
|
{
|
||||||
|
echo wifiUp
|
||||||
|
dds_start
|
||||||
|
}
|
||||||
|
wifiDownAction()
|
||||||
|
{
|
||||||
|
echo wifiDown
|
||||||
|
dds_stop
|
||||||
|
}
|
||||||
|
wifiChangeAction()
|
||||||
|
{
|
||||||
|
echo wifiChange
|
||||||
|
dds_stop
|
||||||
|
dds_start
|
||||||
|
}
|
||||||
|
wifiRequestingIp()
|
||||||
|
{
|
||||||
|
echo wifiRequestingIp
|
||||||
|
}
|
||||||
|
|
||||||
|
checkwifistate()
|
||||||
|
{
|
||||||
|
local flag=0
|
||||||
|
local last_ip_address=0
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
wpa_state=`wpa_cli -iwlan0 status | grep wpa_state | awk -F '=' '{printf $2}'`
|
||||||
|
ip_address=`wpa_cli -iwlan0 status | grep ip_address | awk -F '=' '{printf $2}'`
|
||||||
|
|
||||||
|
if [ "${wpa_state}"x = "COMPLETED"x ];then
|
||||||
|
if [ "${ip_address}"x != ""x ] && [ "${ip_address}"x != "0.0.0.0"x ];then
|
||||||
|
if [ $flag -eq 0 ];then
|
||||||
|
flag=1
|
||||||
|
wifiUpAction
|
||||||
|
elif [ "${ip_address}"x != "${last_ip_address}"x ];then
|
||||||
|
flag=1
|
||||||
|
wifiChangeAction
|
||||||
|
else
|
||||||
|
flag=1
|
||||||
|
wifiReadyAction
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
flag=0
|
||||||
|
wifiRequestingIp
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $flag -eq 1 ];then
|
||||||
|
flag=0
|
||||||
|
wifiDownAction
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
last_ip_address="${ip_address}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
$PROCESS stop
|
||||||
|
checkwifistate
|
||||||
Reference in New Issue
Block a user