This commit is contained in:
yumoqing 2024-09-11 16:20:07 +08:00
parent f4822d38b9
commit 0371c9c671

View File

@ -18,9 +18,9 @@ def bytes_to_audio_frame(bytes_data, format='s16', layout='mono', sample_rate=16
- sample_rate: 采样率 - sample_rate: 采样率
""" """
# 根据给定的参数创建AudioFrame # 根据给定的参数创建AudioFrame
frame = AudioFrame(format=format, layout=layout, frame = AudioFrame(format=format,
samples=len(bytes_data) // 2, layout=layout,
rate=sample_rate) samples=len(bytes_data) // 2)
# 将字节数据复制到AudioFrame中 # 将字节数据复制到AudioFrame中
frame.planes[0].update(bytes_data) frame.planes[0].update(bytes_data)