diff --git a/backend/services/audio.py b/backend/services/audio.py
index 4d76cf5..05dbb0e 100644
--- a/backend/services/audio.py
+++ b/backend/services/audio.py
@@ -366,7 +366,7 @@ class AudioService:
channels=num_channels,
dtype=np.float32,
callback=callback,
- blocksize=2048,
+ blocksize=1024,
)
self._live_caller_stream.start()
print(f"[Audio] Live caller stream started on ch {self.live_caller_channel} @ {device_sr}Hz")
@@ -438,7 +438,7 @@ class AudioService:
channels=max_channels,
samplerate=device_sr,
dtype=np.float32,
- blocksize=4096,
+ blocksize=1024,
callback=callback,
)
self._host_stream.start()
diff --git a/backend/services/caller_service.py b/backend/services/caller_service.py
index 9ac870c..75d282e 100644
--- a/backend/services/caller_service.py
+++ b/backend/services/caller_service.py
@@ -119,9 +119,12 @@ class CallerService:
try:
if sample_rate != 16000:
import numpy as np
- import librosa
audio = np.frombuffer(pcm_data, dtype=np.int16).astype(np.float32) / 32768.0
- audio = librosa.resample(audio, orig_sr=sample_rate, target_sr=16000)
+ ratio = 16000 / sample_rate
+ out_len = int(len(audio) * ratio)
+ indices = (np.arange(out_len) / ratio).astype(int)
+ indices = np.clip(indices, 0, len(audio) - 1)
+ audio = audio[indices]
pcm_data = (audio * 32767).astype(np.int16).tobytes()
await ws.send_bytes(pcm_data)
except Exception as e:
diff --git a/frontend/call-in.html b/frontend/call-in.html
index b662c22..aa72937 100644
--- a/frontend/call-in.html
+++ b/frontend/call-in.html
@@ -150,6 +150,6 @@
-
+