Turn Discord mic processing off for TTS playback

This commit is contained in:
Fisto
2026-09-21 18:13:28 +02:00
parent 15901849a1
commit 17d4339ea3
8 changed files with 207 additions and 1 deletions
+28
View File
@@ -484,6 +484,34 @@ function buildServer(): McpServer {
jsonText(await pacedVoice(() => requireCore().voiceJoin(channelId, mute ?? true)))
);
server.registerTool(
"set_voice_processing",
{
description:
"Read or change Discord's microphone processing. Defaults turn noise suppression, " +
"echo cancellation, automatic gain control, and noise cancellation off, which stops " +
"the call from ramping in and clipping the first words of TTS. Voice joins already " +
"do this automatically.",
inputSchema: {
noiseSuppression: z.boolean().optional(),
echoCancellation: z.boolean().optional(),
automaticGainControl: z.boolean().optional(),
noiseCancellation: z.boolean().optional(),
inputVolume: z.number().min(0).max(200).optional().describe("Discord input volume percent")
}
},
async ({ noiseSuppression, echoCancellation, automaticGainControl, noiseCancellation, inputVolume }) =>
jsonText(
await requireCore().voiceProcessing({
...(noiseSuppression !== undefined ? { noiseSuppression } : {}),
...(echoCancellation !== undefined ? { echoCancellation } : {}),
...(automaticGainControl !== undefined ? { automaticGainControl } : {}),
...(noiseCancellation !== undefined ? { noiseCancellation } : {}),
...(inputVolume !== undefined ? { inputVolume } : {})
})
)
);
server.registerTool(
"voice_leave",
{
+13
View File
@@ -216,6 +216,19 @@ export class CoreClient {
return this.request("voice.devices");
}
/** Read/turn off Discord's mic processing gates (noise suppression, AGC, echo). */
async voiceProcessing(
settings: {
noiseSuppression?: boolean;
echoCancellation?: boolean;
automaticGainControl?: boolean;
noiseCancellation?: boolean;
inputVolume?: number;
} = {}
) {
return this.request("voice.processing", settings);
}
async voiceSetDevices(inputDeviceId?: string, outputDeviceId?: string) {
return this.request("voice.setDevices", {
...(inputDeviceId ? { inputDeviceId } : {}),
+9
View File
@@ -190,6 +190,15 @@ function handle(action: string | undefined, params: any) {
userVolumes[userId] = volume;
return { userId, volume, outputVolume };
}
case "voice.processing":
return {
noiseSuppression: false,
echoCancellation: false,
automaticGainControl: false,
noiseCancellation: false,
inputVolume: null
};
case "voice.setDevices":
return { inputDeviceId: params?.inputDeviceId ?? null, outputDeviceId: params?.outputDeviceId ?? null };
case "user.search": {