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: 采样率
"""
# 根据给定的参数创建AudioFrame
frame = AudioFrame(format=format, layout=layout,
samples=len(bytes_data) // 2,
rate=sample_rate)
frame = AudioFrame(format=format,
layout=layout,
samples=len(bytes_data) // 2)
# 将字节数据复制到AudioFrame中
frame.planes[0].update(bytes_data)