Search code examples
audioautohotkeymicrophone

autohotkey soundset doesn't change mic


I'm trying to set my microphone to 50% with autohotkey but it only sets my master volume. I've tried

SoundSet 1, Microphone, 50

but it doesn't work. I also tried all the numbers up to 6.


Solution

  • I actually wrote something for this a while ago on the AHK subreddit. You can use this to toggle your mic volume to 50%. Pressing it again will set the volume back to whatever the original value was.

    Give it a shot. If it doesn't work, let me know.
    If it does, then you can mark your question answered.

    1. Set your mic volume to something easy to remember but not common like 77. This is a temporary step to get the right audio device. You can change this later.

    2. Run this script. PProvost wrote this and it can be found in the AHK Docs, too.

    3. Look for the volume level that's set to 77. Note the component type (should look like Master:1), control type (most likely Volume or Microphone), and the mixer (which varies on each system. Mine was 10.)

     

    ;=============== Set This Stuff ===============
    ; Get this info from PProvost's script. If you lose the URL later, it's:
    ; https://github.com/PProvost/AutoHotKey/blob/master/SoundCardAnalysis.ahk
    
    ; Component Type
    compType    := "Master:1"
    
    ; Control Type
    conType     := "Volume"
    
    ; Mixer Number
    mixer       := 10
    
    ;Toggle tracker
    toggle      := 0
    
    ;=============== End "Set This Stuff" Section ===============
    ; Hotkey to set/toggle volume
    F1::
        ; Tracks sound status
        toggle = !toggle
    
        ; If toggle is turned on
        if (toggle = 1){
    
            ; Save old setting
            SoundGet, oldSound, % compType, % conType, % mixer
    
            ; Set new setting
            SoundSet, 50, % compType, % conType, % mixer
    
        ; If toggle is off
        }Else
    
            ; Revert to the old setting
            SoundSet, % oldSound, % compType, % conType, % mixer
    return
    
    ; Shift+Escape kills the app.
    +Escape::ExitApp