mute mac audio

Dear Lazyweb,

How do I mute the "Line In" audio input on MacOS 10.4 (a G4 tower) without physically unplugging a cable? Doing this:

    osascript -e 'set volume input volume 0'

has the effect of moving the "Input Volume" slider in Preferences/Sound all the way to the left. However, that does not silence the audio, it only reduces it slightly.

Tags: , , ,

24 Responses:

  1. d1sgruntle says:

    I tried it with 10.5.3, and yes, the slider moved all the way to the left. And silenced the input.

    So I think this is as you say "WORKS FOR ME"

    It's time Lazyweb remembered how lazy it can be.

    • jwz says:

      Alternately, you are deaf.

      • d1sgruntle says:

        Would you prefer a nice youtube post of my mac not making any noise? Maybe I can rig up a nice scope for evidence. Oh, wait, even better, I can go take an otherwise useful scope and solder on some gears so it gets the steampunk thing as well? Maybe I can get Cory Doctorow to write a piece about my steampunk oscilloscope proving a new movement in freedom from noise. And then get his Boingboing friend Mark Frauenfelder to run a piece in MAKE featuring my steampunk o-scope proving that my mac is now silent.

        Would that satisfy your sense of entitlement?

  2. ivorjawa says:

    I wish Apple built machines as well now as they did in 2002.

    • jwz says:

      I can't tell which one you think does what I need, "SoundSource" or "PongSaver". Because it doesn't look like either does.

      • xv says:

        Yeah I dunno. If you need a script you can UI click at a different source? Or at something in midi setup? meh

    • jwz says:

      I installed it, and that doesn't appear to do anything that the standard pref panel doesn't. In particular, it has no "mute" control.

      • mattbot says:

        I guess the feature got pulled in an update. Maybe due to an OS change? I'm afraid Jake/the NSA may be right; you might have to use kextunload and kextload to manage the audio input kernel extension assuming there is nothing dependent on it. I wouldn't go so far as to recommend it but I can't think of anything else.

        • mattbot says:

          Compile the Phantom Audio Driver example code located in /Developer/Examples/Kernel/IOKit/Audio/PhantomAudioDriver/. It requires some tweeking (see - especialy the bit about the preprocessor #define KPI_10_4_0_PPC_COMPAT line) because life is pain. Set the ownership of the newly minted PhantomAudioDriver.kext to root:wheel and chmod it 755. It's a bundle so do this recursively. Run kextload -t PhantomAudioDriver.kext. Figure out what you forgot to do. Reset the permissions. Debug and recompile. Run kextload -t PhantomAudioDriver.kext again. Set the permissions again. Repeat as necessary. Open the Sound Preference Pane. Marvel at the new phantom audio input device. Write an AppleScript that toggles the audio input device between line-in and the phantom device and name it "Toggle Mute". Pretend the silence is muted line-in silence and not unmuted virtual non-noise.

          • jwz says:

            I think it'd probably be easier to just buy a $10 USB mic and plug that in, so that I had two input devices to switch between. (I only have the one now, since this Mac has no built-in mic.)

            But! I wonder if there's some easy* way to have a fake audio device that plays an MP3 in a loop, so that it would say "come back at 10pm" or something instead of silence.

            * Where "Easy" means "not using a C compiler".

            • mattbot says:

              I'm sorry, that requires physical cable manipulation and is thus disqualified. Try again.

              • mattbot says:

                For the second part, you could probably use Quartz Composer (Apple's Max/MSP knockof; it's in /Developer somewhere) to act as a switcher between the line-in and a looping mp3. It's all drag and drop too.

            • mattbot says:

              The IS an easily routed, virtual audio device and is free to boot! Cycling74 (the Max/MSP peeps) has solution called Soundflower which will allow* that in conjuction with another media player to run the mp3.


              * Scriptable switching between input devices not included.

          • jwz says:

            Hey, awesome -- there appears to be no way to switch input devices from AppleScript. There's no "set input device" analog of "set volume input", etc.

            (Well I guess you could do it by launching the System Preferences app and clicking the third button on the fifth tab or some shit, but no. Just no.)

            • mattbot says:

              Sadly, System Preferences is not recordable but in our exciting modern times, AppleScript has access to system level events if the "Enable access for assistive devices" checkbox in the Universal Access pref panes is checked. Yes, this is about as fun as coding XML parsing routines from scratch but there are a couple of inspector apps to make this easier/possible.

              Apple's bare bones UI Element Inspector:

              Prefabs slicker commercial product (~$50):

              The Apple GUI Scripting guide:

            • seminiferous says:

              If you ever get so desperate that you decide to do the script-System-Preferences thing, here is the AppleScript I used to do it. It might save you a little time. As another poster said, I believe you need to enable assistive devices under the Universal Access pref. This was on 10.3. Yes I am ashamed.

              tell application "System Preferences"
              set current pane to pane ""

              tell application "System Events"
              tell process "System Preferences"
              tell tab group 1 of window "Keyboard & Mouse"
              click radio button "Mouse"
              set value of slider 1 to 0
              set value of slider 1 to 7
              end tell
              end tell
              end tell
              end tell

              (It's a workaround for a bug in the Logitech mouse drivers.)

  3. strangedave says:

    The Audio MIDI Setup utility includes mute buttons.

  4. netsharc says:

    I had/still have a similar problem on my Sound Blaster PCI on an AMD/Windows PC. In my Windows' Volume Control there's a slider for Line-In and Aux. If I mute the Line-In I still hear some noise, apparently the audio from the Line-In bleeds through on the Aux channel, if I mute Aux then the Line-In volume control works properly.

    Perhaps you've got the same hardware quirk..

  5. gryazi says:

    This link makes reference to a "mute setting," although it only makes reference to output muting.

    Then, referring to what would be both an I and O device, they mention that unmuting an output will fix a muted input:

    I have no clue how the devices are enumerated for AppleScript or anything else, but is it possible there's an inobvious output pipe for the specific input that can be muted without killing regular output?

  6. kevinspencer says:

    Nice choice of music for this post by the way. The three albums INXS made that were pure joy: Shabooh Shoobah, The Swing, Listen Like Thieves. Then they sucked after that.

    That is all.