32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { DenoiseModelId, NoiseSuppressionMode } from '../state/settings';
|
|||
|
|
|
||
|
|
/**
|
||
|
|
* Payload for the fork's `io.lotus.set_denoise` action, which switches noise
|
||
|
|
* suppression on the live mic mid-call (browser suppressor on/off and/or the
|
||
|
|
* ML model) instead of needing a rejoin.
|
||
|
|
*/
|
||
|
|
export type LotusDenoisePayload = {
|
||
|
|
mode: NoiseSuppressionMode;
|
||
|
|
model: DenoiseModelId;
|
||
|
|
nativeNS: boolean;
|
||
|
|
gate: boolean;
|
||
|
|
gateThreshold: number;
|
||
|
|
};
|
||
|
|
|
||
|
|
export type DenoiseSettings = {
|
||
|
|
callNoiseSuppression?: NoiseSuppressionMode;
|
||
|
|
callDenoiseModel?: DenoiseModelId;
|
||
|
|
callDenoiseNativeNS?: boolean;
|
||
|
|
callDenoiseGate?: boolean;
|
||
|
|
callDenoiseGateThreshold?: number;
|
||
|
|
};
|
||
|
|
|
||
|
|
/** Same defaults as the call URL built at join (useCallStart/createCallEmbed). */
|
||
|
|
export const buildDenoisePayload = (s: DenoiseSettings): LotusDenoisePayload => ({
|
||
|
|
mode: s.callNoiseSuppression ?? 'browser',
|
||
|
|
model: s.callDenoiseModel ?? 'rnnoise',
|
||
|
|
nativeNS: s.callDenoiseNativeNS ?? true,
|
||
|
|
gate: s.callDenoiseGate ?? false,
|
||
|
|
gateThreshold: s.callDenoiseGateThreshold ?? -45,
|
||
|
|
});
|