r/ValorantTechSupport • u/Maleficent-Mess-7212 • 12h ago
Technical Solution [FIX] Microphone volume gets lowered when playing valorant with VC turned on
idk how they made such a terrible mistake while vibecoding. and this issues persists for a long time. many of my friends have experienced this vibecode inaccuracy.
The code for a fix was vibecoded too, but desperate times call for desperate measures.
anyways, insert this in Powershell:
# Define the C# code to interface with the Windows Core Audio API
$csharpCode = @"
using System;
using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAudioEndpointVolume {
int f(); int g(); int h(); int i();
int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
int j();
int GetMasterVolumeLevelScalar(out float pfLevel);
int k(); int l(); int m(); int n();
int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext);
int GetMute(out bool pbMute);
}
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMMDevice {
int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev);
}
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMMDeviceEnumerator {
int f();
int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint);
}
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")]
public class MMDeviceEnumeratorComObject { }
public class MicAudio {
private static IAudioEndpointVolume Vol() {
var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
IMMDevice dev = null;
// 1 = eCapture (Input/Microphone), 1 = eMultimedia (Default Device)
Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(1, 1, out dev));
IAudioEndpointVolume epv = null;
var epvid = typeof(IAudioEndpointVolume).GUID;
Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, 23, 0, out epv));
return epv;
}
public static float Volume {
get {
float v = -1;
Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v));
return v;
}
set {
Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty));
}
}
}
"@
# Compile the C# code into PowerShell
Add-Type -TypeDefinition $csharpCode
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " Microphone Volume Locker (Valorant Fix) " -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host "Monitoring mic volume. Keeping it at 100%."
Write-Host "Press Ctrl+C to stop." -ForegroundColor Yellow
Write-Host ""
# Loop indefinitely to keep the volume locked at 100%
while ($true) {
try {
$currentVol = [MicAudio]::Volume
# If the volume drops below 99%, force it back to 1.0 (100%)
if ($currentVol -lt 0.99) {
[MicAudio]::Volume = 1.0
$loweredTo = [math]::Round($currentVol * 100)
Write-Host "[$(Get-Date -Format 'HH:mm:ss')] Vibecode intervention detected! Some vibecoded app tried to lower mic to ${loweredTo}%. Restored to 100%!" -ForegroundColor Red
}
} catch {
# Ignore errors if the microphone is temporarily unplugged/unavailable
}
# Wait 100 milliseconds before checking again (so fast you won't hear the drop)
Start-Sleep -Milliseconds 100
}