Improve noise detection heuristic

This commit is contained in:
Daniel Wolf 2016-09-29 11:41:31 +02:00
parent 760f6c2ce6
commit f44baaa05f
2 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,14 @@ BoundedTimeline<void> detectVoiceActivity(const AudioClip& inputAudioClip, int m
} }
} }
// Shorten activities. WebRTC adds a bit of buffer at the end.
const centiseconds tail(5);
for (const auto& utterance : Timeline<void>(activity)) {
if (utterance.getTimeRange().getLength() > tail && utterance.getEnd() < audioLength) {
activity.clear(utterance.getEnd() - tail, utterance.getEnd());
}
}
logging::debugFormat("Found {} sections of voice activity: {}", activity.size(), logging::debugFormat("Found {} sections of voice activity: {}", activity.size(),
join(activity | transformed([](const Timed<void>& t) { return format("{0}-{1}", t.getStart(), t.getEnd()); }), ", ")); join(activity | transformed([](const Timed<void>& t) { return format("{0}-{1}", t.getStart(), t.getEnd()); }), ", "));

View File

@ -288,7 +288,7 @@ Timeline<void> getNoiseSounds(TimeRange utteranceTimeRange, const Timeline<Phone
} }
// Remove undesired elements // Remove undesired elements
const centiseconds minSoundLength = 5_cs; const centiseconds minSoundLength = 12_cs;
for (const auto& unknownSound : Timeline<void>(noiseSounds)) { for (const auto& unknownSound : Timeline<void>(noiseSounds)) {
bool startsAtZero = unknownSound.getStart() == 0_cs; bool startsAtZero = unknownSound.getStart() == 0_cs;
bool tooShort = unknownSound.getTimeRange().getLength() < minSoundLength; bool tooShort = unknownSound.getTimeRange().getLength() < minSoundLength;