Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试用quiet.py发送音频未成功 #3

Open
fujianzz opened this issue Nov 22, 2023 · 0 comments
Open

尝试用quiet.py发送音频未成功 #3

fujianzz opened this issue Nov 22, 2023 · 0 comments

Comments

@fujianzz
Copy link

你好,这个python版本的quiet用起来比c版本的要更方便,我写了一个demo验证使用quiet.py编码的数据再使用pyaudio发送,正确的播放了声音,但是确无法使用quiet解析它,可以帮忙分析下原因么?代码如下:
`import numpy as np
import pyaudio
from quiet import Encoder, Decoder

CHUNK = 16384 # 每个缓冲区的大小
FORMAT = pyaudio.paFloat32 # 采样位数为16位
CHANNELS = 1 # 声道数为1
RATE = 44100 # 采样率为44100Hz

encoder = Encoder()

#使用 PyAudio 播放音频
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paFloat32, channels=1, rate=44100, output=True)

#播放音频
for chunk in encoder.encode('hello, world'):
stream.write(chunk)

#关闭流
stream.stop_stream()
stream.close()
p.terminate()`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant