mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-13 06:07:01 +00:00
upgraded
This commit is contained in:
parent
6ae9d52d98
commit
150e7f3251
@ -68,19 +68,21 @@ class AudioRecorder:
|
|||||||
self.lollmsCom = lollmsCom
|
self.lollmsCom = lollmsCom
|
||||||
|
|
||||||
def start_recording(self):
|
def start_recording(self):
|
||||||
self.is_recording = True
|
try:
|
||||||
self.audio_stream = pyaudio.PyAudio().open(
|
self.is_recording = True
|
||||||
format=self.audio_format,
|
self.audio_stream = pyaudio.PyAudio().open(
|
||||||
channels=self.channels,
|
format=self.audio_format,
|
||||||
rate=self.sample_rate,
|
channels=self.channels,
|
||||||
input=True,
|
rate=self.sample_rate,
|
||||||
frames_per_buffer=self.chunk_size
|
input=True,
|
||||||
)
|
frames_per_buffer=self.chunk_size
|
||||||
|
)
|
||||||
|
|
||||||
self.lollmsCom.info("Recording started...")
|
self.lollmsCom.info("Recording started...")
|
||||||
|
|
||||||
threading.Thread(target=self._record).start()
|
|
||||||
|
|
||||||
|
threading.Thread(target=self._record).start()
|
||||||
|
except:
|
||||||
|
self.lollmsCom.error("No audio input found!")
|
||||||
def _record(self):
|
def _record(self):
|
||||||
while self.is_recording:
|
while self.is_recording:
|
||||||
data = self.audio_stream.read(self.chunk_size)
|
data = self.audio_stream.read(self.chunk_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user