[go: up one dir, main page]

Skip to content

Commit

Permalink
[services]: optimize voice recorder strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
muqiuhan committed Jun 26, 2024
1 parent ae25ef4 commit b7bf719
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autumnbot/services/voice_recorder/voice_recorder_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
CHANNELS: int = 1
RATE: int = 44100
FRAMES_PER_BUFFER: int = 1024
AUDIO_MIN_RMS: int = 5000
AUDIO_MIN_RMS: int = 200
MAX_LOW_AUDIO_FLAG: int = 100
3 changes: 2 additions & 1 deletion autumnbot/services/voice_recorder/voice_recorder_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def run(self) -> None:

if low_audio_flag > config.MAX_LOW_AUDIO_FLAG:
if len(self.__frames) <= (
int(config.RATE / config.FRAMES_PER_BUFFER * 2) + 50
int(config.RATE / config.FRAMES_PER_BUFFER * 2) + 100
):
self.__frames.clear()
low_audio_flag = 0
continue
path = "{}.wav".format(int(time.time()))
Expand Down

0 comments on commit b7bf719

Please sign in to comment.