1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

Android: Voice typing: Improve silence detection (#12404)

This commit is contained in:
Henry Heino
2025-06-07 04:56:41 -07:00
committed by GitHub
parent 100c35cf7f
commit f0d1dd1dd0

View File

@@ -126,7 +126,7 @@ WhisperSession::splitAndTranscribeBefore_(int transcribeUpTo, int trimTo) {
}
bool WhisperSession::isBufferSilent_() {
int toleranceSamples = WHISPER_SAMPLE_RATE / 8; // 0.125s
int toleranceSamples = WHISPER_SAMPLE_RATE / 5; // 0.2s
auto silence = findLongestSilence(
audioBuffer_,
LongestSilenceOptions {
@@ -145,7 +145,7 @@ WhisperSession::transcribeNextChunk() {
// Handles a silence detected between (splitStart, splitEnd).
auto splitAndProcess = [&] (int splitStart, int splitEnd) {
int tolerance = WHISPER_SAMPLE_RATE / 20; // 0.05s
int tolerance = WHISPER_SAMPLE_RATE / 8; // 0.125s
bool isCompletelySilent = splitStart < tolerance && splitEnd > audioBuffer_.size() - tolerance;
LOGD("WhisperSession: Found silence range from %.2f -> %.2f", splitStart / (float) WHISPER_SAMPLE_RATE, splitEnd / (float) WHISPER_SAMPLE_RATE);