日志如下: 这是文字版:rk_mpi_ai_test --sound_card_name=hw:0,0 --device_rate=16000 --device_ch=2 --out_rate=16000 --out_ch=2 --output=/tmp
对于保存的pcm文件,我使用Audacity软件进行试听;此外,我使用以下脚本将pcm转换为wav文件,# rk_mpi_ai_test --sound_card_name=hw:0,0 --device_rate=16000 --device_ch=2 --out_rate=16000 --out_ch=2 --output=/tmp
cmd parse result:
input file name : (null)
output file name : /tmp
loop count : 1
channel number : 1
open sound rate : 16000
record data rate : 16000
sound card channel : 2
output channel : 2
bit_width : 16
frame_number : 4
frame_length : 1024
sound card name : hw:0,0
device id : 0
set volume : 100
set mute : 0
set track_mode : 0
get volume : 0
get mute : 0
get track_mode : 0
aed enable : 0
bcd enable : 0
buz enable : 0
vqe gap duration (ms) : 16
vqe enable : 0
vqe config file : (null)
dump algo pcm data : 0
test mode : 0
aenc file name : (null)
input codec name : (null)
rockit log path (null), log_size = 0, can use export rt_log_path=, export rt_log_size= change
log_file = (nil)
RTVersion 01:30:20-150 {dump :064} ---------------------------------------------------------
RTVersion 01:30:20-151 {dump :065} rockit version: git-8cb4d25b8 Tue Feb 28 11:12:39 2023 +0800
RTVersion 01:30:20-151 {dump :066} rockit building: built- 2023-02-28 15:23:19
RTVersion 01:30:20-151 {dump :067} ---------------------------------------------------------
(null) 01:30:20-151 {log_level_init :203}
please use echo name=level > /tmp/rt_log_level set log level
name: all cmpi mb sys vdec venc rgn vpss vgs tde avs wbc vo vi ai ao aenc adec
log_level: 0 1 2 3 4 5 6
rockit default level 4, can use export rt_log_level=x, x=0,1,2,3,4,5,6 change
(null) 01:30:20-151 {read_log_level :093} text is all=4
(null) 01:30:20-152 {read_log_level :095} module is all, log_level is 4
(null) 01:30:20-159 {monitor_log_level :144} #Start monitor_log_level thread, arg:(nil)
cmpi 01:30:20-165 {main :1295} start running loop count = 0
RKAiChn 01:30:20-167 {setAedAttr :789} pstAedConfig = (nil), set mAedEnable = false
RKAiChn 01:30:20-169 {setBcdAttr :852} pstBcdConfig = (nil), set mBcdEnable = false
RKAiChn 01:30:20-171 {setBuzAttr :915} pstBuzConfig = (nil), set mBuzEnable = false
RKAiChn 01:30:20-171 {setGbsAttr :979} pstGbsConfig = (nil), set mGbsEnable = false
RKAiChn 01:30:20-171 {setVqeAttr :1045} pstVqeConfig = (nil), set mVqeEnable = false
RKAiChn 01:30:20-171 {prepareGraph :221} check enabled - vqe:0 aed:0 bcd:0 buz:0 gbs:0
RTFlowGraph 01:30:20-177 {setMaxInputStreamQ:287} ai: Illegal operation, no input port exists.
RKAiChn 01:30:20-293 {setVqeEnable :1019} not support veq algo
cmpi 01:30:20-297 {commandThread :829} test info : mute = 0, volume = 100
cmpi 01:30:20-299 {saveFile :708} create file(/tmp/cap_out.pcm) succeed
但无论是pcm文件,还是wav文件,我播放后,都只听到10秒刺耳的蜂鸣声(不像是录制的声音)。def pcm_to_wav(pcm_path, wav_path=None, channels=1, bits=16, sample_rate=16000):
if wav_path is None:
wav_path = os.path.splitext(pcm_path)[0] + ".wav"
pcmf = open(pcm_path, 'rb')
pcmdata = pcmf.read()
pcmf.close()
if bits % 8 != 0:
raise ValueError("bits % 8 must == 0. now bits:" + str(bits))
wavfile = wave.open(wav_path, 'wb')
wavfile.setnchannels(channels)
wavfile.setsampwidth(bits // 8)
wavfile.setframerate(sample_rate)
wavfile.writeframes(pcmdata)
wavfile.close()
print(f"converted .pcm to .wav successfully, and saved into {wav_path}.")
我只想完成麦克风的录制功能?请问是哪里出问题了吗?