fix(audio): resolve PyAudio paInt16 attribute error on reconnection (#204)
The _attempt_audio_reconnection method was incorrectly accessing paInt16 as an attribute of the PyAudio instance instead of the pyaudio module. Added local import and fixed the reference. Fixes #203
This commit is contained in:
@@ -1661,6 +1661,8 @@ class SpeechRecognitionManager:
|
||||
Returns:
|
||||
bool: True if reconnection was successful, False otherwise
|
||||
"""
|
||||
import pyaudio
|
||||
|
||||
self._reconnection_attempts += 1
|
||||
|
||||
if self._reconnection_attempts > self._max_reconnection_attempts:
|
||||
@@ -1689,7 +1691,7 @@ class SpeechRecognitionManager:
|
||||
|
||||
# Stream configuration
|
||||
CHUNK = 1024
|
||||
FORMAT = audio_instance.paInt16
|
||||
FORMAT = pyaudio.paInt16
|
||||
CHANNELS = 1
|
||||
RATE = 16000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user