Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies = [
"einx[torch]==0.2.2",
"zstandard>=0.22.0",
"pydub",
"pyaudio",
"modelscope==1.17.1",
"opencc-python-reimplemented==0.1.7",
"silero-vad",
Expand Down Expand Up @@ -70,6 +69,9 @@ cu129 = [
"torch==2.8.0",
"torchaudio",
]
# Optional: native audio playback for the streaming api_client (PyAudio needs
# system PortAudio headers; keeping it out of core unblocks slim / headless installs).
client = ["pyaudio"]

[tool.uv]
override-dependencies = [
Expand Down
9 changes: 8 additions & 1 deletion tools/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import wave

import ormsgpack
import pyaudio
import requests
from pydub import AudioSegment
from pydub.playback import play
Expand Down Expand Up @@ -198,6 +197,14 @@ def parse_args():

if response.status_code == 200:
if args.streaming:
try:
import pyaudio
except ImportError:
raise ImportError(
"Streaming playback requires PyAudio. Install it with: "
"pip install -e .[client]"
)

p = pyaudio.PyAudio()
audio_format = pyaudio.paInt16 # Assuming 16-bit PCM format
stream = p.open(
Expand Down