How to disable sound output through internal speakers

Posted:
in Genius Bar edited January 2014
Does anyone know how to disable sound output through an iMac's internal speakers so that sound output is limited to the headphone jack? I muted the sound in system preferences so that you can only get sound through the jack, but the computers are un-muted by raising the volume.



Kids are constantly playing loud music in our computer labs (no matter how many times you tell them not to). The only thread that I found on this did not answer the question but rather concluded that you should make it a policy not to listen to music in the labs. While stating the obvious, this is not a technical solution to the problem. First, there are multiple labs and I can't be in all of them at the same time to enforce this, and second, enforcing this policy is tiring and I'd rather not have to deal with it.



Thanks.

Comments

  • Reply 1 of 20
    One thing you could try, and I have not done this, is to install a driver for a sound card that doesn't exist. Then go into the sound options and choose the fake sound card as your output. Like I said if that doesn't work I haven't tried it, but it may be worth checking out. Good luck.
  • Reply 2 of 20
    taskisstaskiss Posts: 1,212member
    Quote:
    Originally Posted by Neruda View Post


    Does anyone know how to disable sound output through an iMac's external speakers so that sound output is limited to the headphone jack?



    Remove the external speakers.
  • Reply 3 of 20
    Quote:
    Originally Posted by Taskiss View Post


    Remove the external speakers.



    Sorry. I meant internal speakers. Original message has been corrected.
  • Reply 4 of 20
    taskisstaskiss Posts: 1,212member
    Quote:
    Originally Posted by Neruda View Post


    Sorry. I meant internal speakers. Original message has been corrected.



    Those should be easily disconnected also.
  • Reply 5 of 20
    Quote:
    Originally Posted by Taskiss View Post


    Those should be easily disconnected also.



    Not so easy to do on 60+ iMacs. Also, the external speakers do need to be used occasionally for classes, so disconnecting all of the internal speakers is not really a viable solution.
  • Reply 6 of 20
    taskisstaskiss Posts: 1,212member
    No temporary, easy solution will withstand the onerous onslaught of dedicated users.



    You could possibly set up an expect script to establish a ssh session and use something like:



    http://www.cs.cmu.edu/~rbd/doc/nyquist/part15.html



    ... to spam the systems with commands to turn off the sound.
  • Reply 7 of 20
    Quote:
    Originally Posted by Taskiss View Post


    No temporary, easy solution will withstand the onerous onslaught of dedicated users.



    The only option right now is to select the computers through Remote Desktop and sending the following unix command:



    case "`uname -r`" in

    7*) osascript -e 'set volume 0 with output muted' ;;

    8*) osascript -e 'set volume output volume 50 with output muted' ;;

    esac



    That mutes the computer, but the user is able to increase the volume again immediately afterwards.



    You'd think this would be a simple thing to do.
  • Reply 8 of 20
    pevepeve Posts: 518member
    -open application textedit

    -type "no loud music!" press return key

    -type "first time = warning" press return key

    -type "second time = 5$ penalty" press command+p and hit return
  • Reply 9 of 20
    Quote:
    Originally Posted by peve View Post


    -open application textedit

    -type "no loud music!" press return key

    -type "first time = warning" press return key

    -type "second time = 5$ penalty" press command+p and hit return



    Open Application Textedit

    Type "You are a dumbass. If you can't answer the specific question of the thread, then STFU."

    Press Command P.

    Tape to forehead.



    Even if I posted such a warning, I can't be in all of the labs at the same time to enforce this and I don't want to have to deal with this at all. Did you even read the freaking responses above before you felt you had to chime in, otherwise, how could you have missed this in my original post:

    Quote:
    Originally Posted by Neruda View Post


    ..The only thread that I found on this did not answer the question but rather concluded that you should make it a policy not to listen to music in the labs. While stating the obvious, this is not a technical solution to the problem. First, there are multiple labs and I can't be in all of them at the same time to enforce this, and second, enforcing this policy is tiring and I'd rather not have to deal with it.





    Do you expect a piece of paper to enforce this policy when I'm not around?



    Thanks for nothing.
  • Reply 10 of 20
    pevepeve Posts: 518member
    cool down - it's called humor - but you don't seem to get the concept of it
  • Reply 11 of 20
    Quote:
    Originally Posted by peve View Post


    cool down - it's called humor - but you don't seem to get the concept of it



    I wasn't looking for humor, I was looking for answers. Your post was completely inapposite to the question. Look that up and go away. You have nothing worthwile to add.
  • Reply 12 of 20
    Somebody has a ruler up their butthole.
  • Reply 13 of 20
    I have the same problem and would love to find a solution. I tell them ALL THE TIME to get headphones!



    Let me know if you've found a solution.







    Quote:
    Originally Posted by Neruda View Post


    The only option right now is to select the computers through Remote Desktop and sending the following unix command:



    case "`uname -r`" in

    7*) osascript -e 'set volume 0 with output muted' ;;

    8*) osascript -e 'set volume output volume 50 with output muted' ;;

    esac



    That mutes the computer, but the user is able to increase the volume again immediately afterwards.



    You'd think this would be a simple thing to do.



  • Reply 14 of 20
    Have them use a restricted user account, and ban access to iTunes. Most kids won't bother to look for a way around this.
  • Reply 15 of 20
    We use NetSupport 10 in our computer labs. When someone decides to ignore requests to use head phones I mute the sound from my station. The student can not activate the sound until I release it. Sadly, this mutes all users. Even students using headphones.
  • Reply 16 of 20
    mcmickmcmick Posts: 1member
    I had the same problem in my classroom. I modified an open source program to do just this. I wrote it 4 years ago and have used it in several labs.



    It will turn down the volume on the internal speaker but allow for the use of the headphone jack.



    Use this link to download the files and insructions. The source code is also included.



    files.me.com/mcmick/d8iinj
  • Reply 17 of 20
    nerudaneruda Posts: 439member
    Quote:
    Originally Posted by mcmick View Post




    files.me.com/mcmick/d8iinj





    Wow. Can you provide a full link to this?



    Thanks
  • Reply 18 of 20

    Quote:


    Originally Posted by mcmick View Post





    files.me.com/mcmick/d8iinj



     


    Any way to link this program you made? I think a lot of school lab managers would find it useful.

  • Reply 19 of 20


    I had a similar problem with the iMac computer labs that I manage. I searched and searched but didn't find anything so made my own solution. A launch daemon is used to run a script that continuously runs while the computer is on. This is what it does - 


     


    Checks to see if the external speakers are selected for output


    If so, it turns the volume to zero


    Checks to see if system has been idle for whatever amount of time


    Shuts down the computer if idle for whatever amount of time


     


    When headphones are plugged in, the volume is not altered at all.


     


    The site says I don't have permission to add attachments so here is the code for com.idle.restart.plist and idle.sh. If you want to recreate the files, use TextEdit. Make sure that it is set to plain text mode, copy the text below and use the correct extensions. It will try to put .txt by default but that will not work. I know it isn't a perfect solution but it does the job pretty well.


     


     


    Quote: com.idle.restart.plist



    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0">

    <dict>

        <key>Label</key>

        <string>com.idle.restart</string>

        <key>OnDemand</key>

        <false/>

        <key>Program</key>

        <string>/Library/Management/idle.sh</string>

        <key>ProgramArguments</key>

        <array>

            <string>/Library/Management/idle.sh</string>

        </array>

        <key>ServiceDescription</key>

        <string>Restarts the computer after it has been idle for 20 minutes</string>

    </dict>

    </plist>



     


    Quote: idle.sh



    #!/bin/sh

    #infinite loop while system is on



    #turn off speakers if enabled

    while [ 1 ]

    do

    OUTPUT=`audiodevice output`



    if [ "$OUTPUT" = "Internal Speakers" ] ; then

    osascript -e "set Volume 0"

    fi



    #idle reboot

    idleTime=`ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'`



    #If the idle time is more than x minutes (x*60 seconds) then restart the machine

    if [ "$idleTime" -ge 1800 ]; then

    INPUT=$( osascript \

    -e 'tell application "System Events"' \

    -e 'activate' \

    -e 'set dialog_result to display dialog "Computer is idle and will restart soon" with title "Idle Computer" with icon caution buttons {"Continue Working"} default button 1 giving up after (60)' \

    -e 'end tell' \

    -e 'tell application "Terminal"' \

    -e 'activate' \

    -e 'end tell' \

    -e 'get button returned of dialog_Result'

    )



    if [[ $INPUT != "Continue Working" ]]; then

    shutdown -h now

    fi

    fi



    # the longer the sleep time, the less cpu this will use. 3 seconds uses about 1% it seems

    sleep 3

    done

     



     


     



    1. Download "audiodevice" command line app from this site: http://whoshacks.blogspot.com/2009/01/change-audio-devices-via-shell-script.html


    2. Copy that command line app to a PATH directory (ie /bin/). Use terminal with root access.


    3. Place the com.idle.restart.plist file in /Library/LaunchDaemons.


    4. Make sure permissions for com.idle.restart are -rw-r--r-- (should be the same as the other permissions in that folder.) Also that the owner is root and group is wheel.


    5. Place idle.sh in /Library/Management


     


    If you don't know how to do the file operations above, google it. Most of this you can easily do with the command line. If you don't want certain parts of the script to be active, just comment out the line(s) with a # symbol.


     


    Hope it is useful to someone.

  • Reply 20 of 20


    This is an old post, but do you have the app to disable sound and does it work under OS 10.7? The IT department updated my lab to 10.7 from 10.6, even though I wanted to stay at 10.6, and a couple of things are "broken" that I'm tweaking. I'd used speakermute but that breaks under 10.7.


     


    -Christopher

Sign In or Register to comment.