mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(voice): apply noise suppression in the mic test (#2714)
This commit is contained in:
1 parent
3affd295e8
commit
d0c84b3d9b
39 files changed
+454
-1276
No files matched your search
+2
-2
@@ -17,7 +17,7 @@ import {
|
||||
getSelectedNoiseSuppressionChoice,
|
||||
setNoiseSuppressionChoice,
|
||||
} from '@app/features/voice/utils/noise_suppression/NoiseSuppressionChoices';
|
||||
import {getNoiseSuppressionChoiceLabelDescriptor} from '@app/features/voice/utils/noise_suppression/NoiseSuppressionLabels';
|
||||
import {getNoiseSuppressionChoiceLabel} from '@app/features/voice/utils/noise_suppression/NoiseSuppressionLabels';
|
||||
import {
|
||||
VOICE_AUTOMATIC_GAIN_CONTROL_DESCRIPTOR,
|
||||
VOICE_DIRECT_INPUT_PROFILE_DESCRIPTOR,
|
||||
@@ -98,7 +98,7 @@ export const AudioProcessingModal = observer(() => {
|
||||
const noiseSuppressionOptions: Array<ComboboxOption<VoiceNoiseSuppressionBackend>> =
|
||||
getNoiseSuppressionChoiceValues().map((backend) => ({
|
||||
value: backend,
|
||||
label: i18n._(getNoiseSuppressionChoiceLabelDescriptor(backend)),
|
||||
label: getNoiseSuppressionChoiceLabel(i18n, backend),
|
||||
}));
|
||||
return (
|
||||
<Modal.Root
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {VoiceNoiseSuppressionBackend} from '@app/features/voice/utils/noise_suppression/NoiseSuppressionBackends';
|
||||
import type {MessageDescriptor} from '@lingui/core';
|
||||
import type {I18n, MessageDescriptor} from '@lingui/core';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
|
||||
const NOISE_SUPPRESSION_ENHANCED_DESCRIPTOR = msg({
|
||||
message: 'Enhanced',
|
||||
comment: 'Noise suppression option label in the voice tab (neural filter). Keep it concise.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_ENHANCED_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Neural filter that removes most background noise.',
|
||||
comment: 'Description for the enhanced (DeepFilterNet3) noise suppression option.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_STANDARD_DESCRIPTOR = msg({
|
||||
message: 'Standard',
|
||||
comment: 'Noise suppression option label in the voice tab (browser default). Keep it concise.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_STANDARD_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Built-in suppression from your browser or system.',
|
||||
comment: 'Description for the standard noise suppression option, which uses the platform suppression.',
|
||||
@@ -38,29 +30,14 @@ const NOISE_SUPPRESSION_GATE_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Cuts audio below a loudness threshold, lowest CPU cost.',
|
||||
comment: 'Description for the noise gate suppression option.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_SPEEX_DESCRIPTOR = msg({
|
||||
message: 'Classic',
|
||||
comment: 'Noise suppression option label for the Speex backend. Keep it concise.',
|
||||
context: 'noise-suppression-option',
|
||||
});
|
||||
const NOISE_SUPPRESSION_SPEEX_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Lightweight classic filter, works on any device.',
|
||||
comment: 'Description for the Speex noise suppression option.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_RNNOISE_DESCRIPTOR = msg({
|
||||
message: 'Balanced',
|
||||
comment: 'Noise suppression option label for the RNNoise backend. Keep it concise.',
|
||||
context: 'noise-suppression-option',
|
||||
});
|
||||
const NOISE_SUPPRESSION_RNNOISE_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Neural filter, full audio bandwidth.',
|
||||
comment: 'Description for the RNNoise noise suppression option.',
|
||||
});
|
||||
const NOISE_SUPPRESSION_GTCRN_DESCRIPTOR = msg({
|
||||
message: 'Focused',
|
||||
comment: 'Noise suppression option label for the GTCRN speech backend. Keep it concise.',
|
||||
context: 'noise-suppression-option',
|
||||
});
|
||||
const NOISE_SUPPRESSION_GTCRN_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'Strongest neural filter for speech, limits audio to the speech range.',
|
||||
comment: 'Description for the GTCRN noise suppression option.',
|
||||
@@ -74,14 +51,17 @@ const STEREO_MICROPHONE_DESCRIPTION_DESCRIPTOR = msg({
|
||||
comment: 'Description for the stereo microphone switch in the voice settings.',
|
||||
});
|
||||
|
||||
const LABELS: Readonly<Record<VoiceNoiseSuppressionBackend, MessageDescriptor>> = {
|
||||
const BACKEND_MODEL_NAMES: Readonly<Partial<Record<VoiceNoiseSuppressionBackend, string>>> = {
|
||||
standard: 'WebRTC',
|
||||
speex: 'Speex',
|
||||
rnnoise: 'RNNoise',
|
||||
gtcrn: 'GTCRN',
|
||||
deep_filter: 'DeepFilterNet',
|
||||
};
|
||||
|
||||
const TRANSLATED_LABELS: Readonly<Partial<Record<VoiceNoiseSuppressionBackend, MessageDescriptor>>> = {
|
||||
none: NOISE_SUPPRESSION_NONE_DESCRIPTOR,
|
||||
standard: NOISE_SUPPRESSION_STANDARD_DESCRIPTOR,
|
||||
gate: NOISE_SUPPRESSION_GATE_DESCRIPTOR,
|
||||
speex: NOISE_SUPPRESSION_SPEEX_DESCRIPTOR,
|
||||
rnnoise: NOISE_SUPPRESSION_RNNOISE_DESCRIPTOR,
|
||||
gtcrn: NOISE_SUPPRESSION_GTCRN_DESCRIPTOR,
|
||||
deep_filter: NOISE_SUPPRESSION_ENHANCED_DESCRIPTOR,
|
||||
};
|
||||
|
||||
const DESCRIPTIONS: Readonly<Record<VoiceNoiseSuppressionBackend, MessageDescriptor>> = {
|
||||
@@ -94,8 +74,11 @@ const DESCRIPTIONS: Readonly<Record<VoiceNoiseSuppressionBackend, MessageDescrip
|
||||
deep_filter: NOISE_SUPPRESSION_ENHANCED_DESCRIPTION_DESCRIPTOR,
|
||||
};
|
||||
|
||||
export function getNoiseSuppressionChoiceLabelDescriptor(backend: VoiceNoiseSuppressionBackend): MessageDescriptor {
|
||||
return LABELS[backend];
|
||||
export function getNoiseSuppressionChoiceLabel(i18n: I18n, backend: VoiceNoiseSuppressionBackend): string {
|
||||
const modelName = BACKEND_MODEL_NAMES[backend];
|
||||
if (modelName) return modelName;
|
||||
const descriptor = TRANSLATED_LABELS[backend];
|
||||
return descriptor ? i18n._(descriptor) : backend;
|
||||
}
|
||||
|
||||
export function getNoiseSuppressionChoiceDescriptionDescriptor(
|
||||
|
||||
Reference in new issue
Block a user