Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJameson Wright <a.jameson.wright@gmail.com>2022-01-17 17:03:03 +0300
committerJameson Wright <a.jameson.wright@gmail.com>2022-01-19 20:25:19 +0300
commit5a3f6780c871e8738670b45ea7f77c7a4866f539 (patch)
tree7fee4440710fa4b1c0ab2cc698aa196588453c07
parenta517b06fb5a693e4cb3bc7704b657793ee638430 (diff)
FEAT(client): Industry standard for hold time
As request in #2453, this commit implements the industry standard for microphone hold time for voice activation detection. The calculation that yields hold time (s) from the iVoiceHold setting is described and comments are added to describe the function of related fields. Implements #2453.
-rw-r--r--src/mumble/AudioInput.cpp1
-rw-r--r--src/mumble/AudioInput.h6
-rw-r--r--src/mumble/Settings.cpp8
3 files changed, 11 insertions, 4 deletions
diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp
index 1e42e24f8..70da11b2d 100644
--- a/src/mumble/AudioInput.cpp
+++ b/src/mumble/AudioInput.cpp
@@ -1068,6 +1068,7 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) {
if (!bIsSpeech) {
iHoldFrames++;
if (iHoldFrames < Global::get().s.iVoiceHold)
+ // Hold mic open until iVoiceHold threshold is reached
bIsSpeech = true;
} else {
iHoldFrames = 0;
diff --git a/src/mumble/AudioInput.h b/src/mumble/AudioInput.h
index c4021433e..3f1225e24 100644
--- a/src/mumble/AudioInput.h
+++ b/src/mumble/AudioInput.h
@@ -210,8 +210,12 @@ protected:
bool bEchoMulti;
Settings::NoiseCancel noiseCancel;
+ // Standard microphone sample rate (samples/s)
static const unsigned int iSampleRate = SAMPLE_RATE;
- static const int iFrameSize = SAMPLE_RATE / 100;
+ /// Based the sample rate, 48,000 samples/s = 48 samples/ms.
+ /// For each 10 ms, this yields 480 samples. This corresponds numerically with the calculation:
+ /// iFrameSize = 48000 / 100 = 480 samples, allowing a consistent 10ms of audio data per frame.
+ static const int iFrameSize = SAMPLE_RATE / 100;
QMutex qmSpeex;
SpeexPreprocessState *sppPreprocess;
diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp
index fd617d636..0a7b46db4 100644
--- a/src/mumble/Settings.cpp
+++ b/src/mumble/Settings.cpp
@@ -323,9 +323,11 @@ Settings::Settings() {
bOnlyAttenuateSameOutput = false;
bAttenuateLoopbacks = false;
iMinLoudness = 1000;
- iVoiceHold = 50;
- iJitterBufferSize = 1;
- iFramesPerPacket = 2;
+ /// Actual mic hold time is (iVoiceHold / 100) seconds, where iVoiceHold is specified in 'frames',
+ /// each of which is has a size of iFrameSize (see AudioInput.h)
+ iVoiceHold = 20;
+ iJitterBufferSize = 1;
+ iFramesPerPacket = 2;
#ifdef USE_RNNOISE
noiseCancelMode = NoiseCancelRNN;
#else