this.recorderManager.start({
duration: 60000,
frameSize: 5,
format: 'pcm',
sampleRate: 8000,
numberOfChannels: 1
});
this.recorderManager.onFrameRecorded((res) => {
console.log('[Recorder] Frame recorded, bufferSize:', res.frameBuffer.byteLength);
const base64 = wx.arrayBufferToBase64(res.frameBuffer);
this.recordClient.sendChunk(this.currentChunkIndex, base64);
this.currentChunkIndex++;
this.setData({
totalChunks: this.data.totalChunks + 1
});
});

1、合成后只有电流声没有其他声音
2、后端合成使用的FFmpeg合成
ffmpeg()
.input(pcmPath)
.inputFormat('mulaw')
.inputOptions(['-ar', '8000', '-ac', '1'])
.output(mp3Path)
.format('mp3')
.on('end', () => {
if (fs.existsSync(pcmPath)) {
fs.unlinkSync(pcmPath);
}
console.log(`[Merger] PCM converted to MP3: ${mp3Path}`);
callback(null, mp3Path);
})
.on('error', (err) => {
console.error('[Merger] FFmpeg convert error:', err.message);
callback(err);
})
.run();
3、版本库为3.15.2系统为 windows