Serial recording*
This paper describes how to use SDK to compile the recording firmware , so that developers can analyze through serial recording when debugging and optimizing the recognition effect and analyzing whether the background noise is normal. We provide recording tools for both Linux and Windows.
1. Recording in linux*
1.1 Recording tool*
The executable file grus-record-tool in the directory 'lvp_tws/tools/record/' is the tool needed for serial recording.
1.2 Compile recording firmware*
Before recording, you need to enable the recording function and the corresponding serial port in the compilation configuration make menuconfig
;
- First, Enable
Has Uart Record-- >
andEnable uart record
inCommon Function Settings-- >
;Has Uart Record-- >
can configure serial port number and baud rate; The general default isuart0
and500000
baudrate, do not need to modify; Has Uart protocol Message2.0
is enabled inCommon Function Settings-- >
. The options inHas uart protocol Message2.0 -->
are generally kept as default. You can also modify the corresponding parameters as required;- Check corresponding serial port number in
Board Options:-- >
, default isuart0
, then checkSupport UART0
, andHas Uart Record-- >
corresponding serial port number must be enabled; - If the above options are enabled, the compiled firmware supports recording.
1.3 Recording instruction*
- View instruction description
$ ./grus-record-tool -h
- Instruction interpretation
Usage: grus-record-tool [-p <uart port path>] [-b uart baudrate] [-c <record channel>] [-o <outfile path>] [-d <record time len>] [-w <wav path>] [-h] -p : e.g. /dev/ttyUSB0 (default:/dev/ttyUSB0) -b : 460800/500000/576000/1000000 (just support 500000 for now) -c : mic0/mic1/fft/logfbank/G-sensor -o : e.g. ./record.pcm (just output pcm data for now, sample rate 16000, 16 bit) -w : e.g. ./record.wav (pcm to wav, just support mic0 or mic1) -d : e.g. 10 (default: 10s) -h : show help info ex. grus-record-tool -p /dev/ttyUSB0 -o record.pcm -p /dev/ttyUSB0 # Select the device serial port corresponding to the PC -b 500000 # Only 500000 baud rate is supported for the time being. You do not need to set it specifically -c mic0/mic1 # Select the source of the recording -o ./record.pcm # Output the pcm file path and file name of the original recording data -w ./record.wav # The wav file path is displayed -d 10 # Set the recording duration. The default value is 10s (unit: s)
-
Sample recording
Generally, you only need to set the serial port number, recording duration, and output file
After the recording starts, some log information will be printed, such as the percentage recorded, countdown, and file name. If the recording is not printed, the recording will not start.$ sudo ./grus-record-tool -p /dev/ttyUSB0 -o record.pcm -d 10
Nationalchip Grus Record /dev/ttyUSB1 % 0.4 | 9.960 s | ./record.pcm % 0.8 | 9.920 s | ./record.pcm % 2 | 9.880 s | ./record.pcm % 6 | 9.840 s | ./record.pcm % 2.0 | 9.800 s | ./record.pcm % 2.4 | 9.760 s | ./record.pcm % 2.8 | 9.720 s | ./record.pcm
2. Recording in windows*
grus-record-tool
It also provides an executable program under windows, considering that some developers do not have a linux environment, especially hardware engineers.
Click the link to download windows-grus-record-tool.zip
After the download is successful, decompress it in windows windows-grus-record-tool.zip
, And then use grus-record-tool.exe
Make a recording, The tool uses the same instruction format as linux.
Start the command window of winodws, go to the decompressed record directory, and run the recording command:
notice
Serial port number in windows, for 'COM8', 'COM1' such format. You can view it through the device manager.