Fix prerol error always 1s
This commit is contained in:
parent
c1c871a27f
commit
a4acc04a91
1 changed files with 3 additions and 2 deletions
|
@ -49,12 +49,13 @@ class VoiceServer(object):
|
||||||
self.hugvey = hugvey
|
self.hugvey = hugvey
|
||||||
|
|
||||||
self.chunk = 4096
|
self.chunk = 4096
|
||||||
self.mic_prerol_sec = .05
|
self.mic_prerol_sec = .2
|
||||||
self.prerol_frame_count = math.ceil(self.input_rate / self.chunk)
|
self.prerol_frame_count = math.ceil((self.input_rate / self.chunk) * self.mic_prerol_sec)
|
||||||
self.prerol_frames = collections.deque(maxlen = self.prerol_frame_count)
|
self.prerol_frames = collections.deque(maxlen = self.prerol_frame_count)
|
||||||
|
|
||||||
self.p = pyaudio.PyAudio()
|
self.p = pyaudio.PyAudio()
|
||||||
# wait a sec for the input devices to come up
|
# wait a sec for the input devices to come up
|
||||||
|
logger.debug("Use a mic prerol of {} frames".format(self.prerol_frame_count))
|
||||||
logger.debug('wait for mic')
|
logger.debug('wait for mic')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
logger.debug('done waiting for mic')
|
logger.debug('done waiting for mic')
|
||||||
|
|
Loading…
Reference in a new issue