Fixed microphone attack/release smooth for the native client and made it actually adjustable
This commit is contained in:
parent
6e93b76089
commit
f0a79f52ba
3 changed files with 30 additions and 3 deletions
|
@ -778,6 +778,25 @@ export class Settings {
|
||||||
valueType: "boolean",
|
valueType: "boolean",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static readonly KEY_MICROPHONE_THRESHOLD_ATTACK_SMOOTH: ValuedRegistryKey<number> = {
|
||||||
|
key: "microphone_threshold_attack_smooth",
|
||||||
|
valueType: "number",
|
||||||
|
defaultValue: .25
|
||||||
|
};
|
||||||
|
|
||||||
|
static readonly KEY_MICROPHONE_THRESHOLD_RELEASE_SMOOTH: ValuedRegistryKey<number> = {
|
||||||
|
key: "microphone_threshold_release_smooth",
|
||||||
|
valueType: "number",
|
||||||
|
defaultValue: .9
|
||||||
|
|
||||||
|
};
|
||||||
|
static readonly KEY_MICROPHONE_THRESHOLD_RELEASE_DELAY: ValuedRegistryKey<number> = {
|
||||||
|
key: "microphone_threshold_release_delay",
|
||||||
|
valueType: "number",
|
||||||
|
description: "Delay for the client to cut of the audio in ms.",
|
||||||
|
defaultValue: 500
|
||||||
|
};
|
||||||
|
|
||||||
static readonly FN_LOG_ENABLED: (category: string) => RegistryKey<boolean> = category => {
|
static readonly FN_LOG_ENABLED: (category: string) => RegistryKey<boolean> = category => {
|
||||||
return {
|
return {
|
||||||
key: "log." + category.toLowerCase() + ".enabled",
|
key: "log." + category.toLowerCase() + ".enabled",
|
||||||
|
|
|
@ -115,6 +115,7 @@ export function initialize_audio_microphone_controller(events: Registry<Micropho
|
||||||
{
|
{
|
||||||
let defaultValue = true;
|
let defaultValue = true;
|
||||||
if(__build.target === "client" && getBackend("native").getVersionInfo().os_platform === "linux") {
|
if(__build.target === "client" && getBackend("native").getVersionInfo().os_platform === "linux") {
|
||||||
|
/* The linux client crashes when it fails to open an alsa stream due too many opened streams */
|
||||||
defaultValue = false;
|
defaultValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,9 +236,16 @@ export class RecorderProfile {
|
||||||
filter.setEnabled(true);
|
filter.setEnabled(true);
|
||||||
filter.setThreshold(this.config.vad_threshold.threshold);
|
filter.setThreshold(this.config.vad_threshold.threshold);
|
||||||
|
|
||||||
filter.setMarginFrames(10); /* 500ms */
|
const releaseDelayMs = settings.getValue(Settings.KEY_MICROPHONE_THRESHOLD_RELEASE_DELAY);
|
||||||
filter.setAttackSmooth(.25);
|
if(__build.target === "web") {
|
||||||
filter.setReleaseSmooth(.9);
|
/* One frame is 20ms */
|
||||||
|
filter.setMarginFrames(Math.ceil(releaseDelayMs / 20));
|
||||||
|
} else {
|
||||||
|
/* the client calculates it wrongly... */
|
||||||
|
filter.setMarginFrames(releaseDelayMs * 960);
|
||||||
|
}
|
||||||
|
filter.setAttackSmooth(settings.getValue(Settings.KEY_MICROPHONE_THRESHOLD_ATTACK_SMOOTH));
|
||||||
|
filter.setReleaseSmooth(settings.getValue(Settings.KEY_MICROPHONE_THRESHOLD_RELEASE_SMOOTH));
|
||||||
} else if(this.config.vad_type === "push_to_talk") {
|
} else if(this.config.vad_type === "push_to_talk") {
|
||||||
const filter = this.registeredFilter["ppt-gate"];
|
const filter = this.registeredFilter["ppt-gate"];
|
||||||
filter.setEnabled(true);
|
filter.setEnabled(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue