diff --git a/src/audio/voiceActivityDetection.cpp b/src/audio/voiceActivityDetection.cpp index b121071..48f2910 100644 --- a/src/audio/voiceActivityDetection.cpp +++ b/src/audio/voiceActivityDetection.cpp @@ -80,6 +80,12 @@ BoundedTimeline detectVoiceActivity(std::unique_ptr audioStre } } + // Pad each activity to give the recognizer some breathing room + const centiseconds padding(3); + for (const auto& element : BoundedTimeline(activity)) { + activity.set(element.getStart() - padding, element.getEnd() + padding); + } + logging::debugFormat("Found {} sections of voice activity: {}", activity.size(), join(activity | transformed([](const Timed& t) { return format("{0}-{1}", t.getStart(), t.getEnd()); }), ", "));