Remove mic preroll to avoid speech polution from Hugvey itself

This commit is contained in:
Ruben van de Ven 2019-04-16 10:21:48 +02:00
parent 267b2d980f
commit 72547ae673

View file

@ -162,17 +162,8 @@ class VoiceServer(object):
logger.debug('block recording {}' .format( logger.debug('block recording {}' .format(
self.hugvey.cmd_server.muteMic)) self.hugvey.cmd_server.muteMic))
# if recording is blocked, store the latest n frames. So we can release
# this buffer to the mic stream
self.prerol_frames.append(f)
# multiply by 0 to disable audio recording while playback # multiply by 0 to disable audio recording while playback
f = audioop.mul(f, 2, 0) f = audioop.mul(f, 2, 0)
elif len(self.prerol_frames) > 0:
self.prerol_frames.append(f)
f = b''.join(self.prerol_frames)
self.prerol_frames.clear()
logger.info('used buffer, len now {}'.format(len(f)))
self.loop.call_soon_threadsafe(self.voice_socket.send, f) self.loop.call_soon_threadsafe(self.voice_socket.send, f)