Fixed microphone attack/release smooth for the native client and made it actually adjustable
parent
6e93b76089
commit
f0a79f52ba
|
@ -778,6 +778,25 @@ export class Settings {
|
|||
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 => {
|
||||
return {
|
||||
key: "log." + category.toLowerCase() + ".enabled",
|
||||
|
|
|
@ -115,6 +115,7 @@ export function initialize_audio_microphone_controller(events: Registry<Micropho
|
|||
{
|
||||
let defaultValue = true;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,9 +236,16 @@ export class RecorderProfile {
|
|||
filter.setEnabled(true);
|
||||
filter.setThreshold(this.config.vad_threshold.threshold);
|
||||
|
||||
filter.setMarginFrames(10); /* 500ms */
|
||||
filter.setAttackSmooth(.25);
|
||||
filter.setReleaseSmooth(.9);
|
||||
const releaseDelayMs = settings.getValue(Settings.KEY_MICROPHONE_THRESHOLD_RELEASE_DELAY);
|
||||
if(__build.target === "web") {
|
||||
/* 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") {
|
||||
const filter = this.registeredFilter["ppt-gate"];
|
||||
filter.setEnabled(true);
|
||||
|
|
Loading…
Reference in New Issue