Turn Discord mic processing off for TTS playback
This commit is contained in:
@@ -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",
|
||||
{
|
||||
|
||||
@@ -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 } : {}),
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user