Improve noise detection heuristic
This commit is contained in:
parent
760f6c2ce6
commit
f44baaa05f
|
@ -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(),
|
||||
join(activity | transformed([](const Timed<void>& t) { return format("{0}-{1}", t.getStart(), t.getEnd()); }), ", "));
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ Timeline<void> getNoiseSounds(TimeRange utteranceTimeRange, const Timeline<Phone
|
|||
}
|
||||
|
||||
// Remove undesired elements
|
||||
const centiseconds minSoundLength = 5_cs;
|
||||
const centiseconds minSoundLength = 12_cs;
|
||||
for (const auto& unknownSound : Timeline<void>(noiseSounds)) {
|
||||
bool startsAtZero = unknownSound.getStart() == 0_cs;
|
||||
bool tooShort = unknownSound.getTimeRange().getLength() < minSoundLength;
|
||||
|
|
Loading…
Reference in New Issue