How to disable sound output through internal speakers
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.
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
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.
Remove the external speakers.
Sorry. I meant internal speakers. Original message has been corrected.
Sorry. I meant internal speakers. Original message has been corrected.
Those should be easily disconnected also.
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.
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.
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.
-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 "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:
..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.
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.
Let me know if you've found a solution.
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.
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
files.me.com/mcmick/d8iinj
Wow. Can you provide a full link to this?
Thanks
Quote:
Originally Posted by mcmick
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.
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
Download "audiodevice" command line app from this site: http://whoshacks.blogspot.com/2009/01/change-audio-devices-via-shell-script.html
Copy that command line app to a PATH directory (ie /bin/). Use terminal with root access.
Place the com.idle.restart.plist file in /Library/LaunchDaemons.
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.
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.
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