Open
Description
电脑端:

点击无法播放
手机端却可以正常播放
使用 Base64
传输语音,部分代码:
def wav_to_amr(input_wav, output_amr):
os.system(f"sox {input_wav} -r 8000 -c 1 {output_amr}")
with open(output_amr, 'rb') as f:
audio = f.read()
audio_base64 = base64.b64encode(audio)
audio_str = audio_base64.decode('utf-8')
return audio_str
voice_base64 = wav_to_amr('a.wav', 'b.amr-nb')
# {'type': 'Voice', 'base64': voice_base64}
Metadata
Assignees
Labels
No labels