KeepSoundAwake
KeepSoundAwake 1.3

Download v1.3 for Jaguar (150K)

Download v1.2 for 10.1.x (212K)

Jonathan Feinberg • jdf@pobox.com

installation instructions )

What is KeepSoundAwake?

KeepSoundAwake sits in the background and plays a "silent sound" every 20 seconds, thereby preventing the audio hardware from sleeping.

KeepSoundAwake is free software. It is free as in beer, and it is free as in redistributable with source code, as explained in the license, below.


Why would I want to do that?

This application is only useful if you have a recent Powerbook and OS X 10.1.2 or higher. It will not hurt otherwise, but there's no point in running it. This application addresses a couple of problems which appear on a Powerbook running OS 10.1.2 or higher. Due to a design flaw, the OS sleeps the audio hardware if 30 seconds go by without any sounds being made, regardless of whether or not the machine is plugged in. This is annoying, as the audio hardware must be "warmed up" for about 2.5 seconds before the system can beep, and during those 2.5 seconds you have to watch the beachball spin.

On top of this design glitch, there's a bug (Apple bug #2845648), which occasionally prevents the audio hardware from waking up again. This can hang those applications which attempt to play sound (such as iTunes, or the menu-bar volume slider).

KeepSoundAwake does seem to prevent the the sound hardware from sleeping, but it does not address at root whatever is causing the hardware to go narcoleptic. Sometimes sound still cuts out, and you must plug something into the headphone jack in order to wake it up. Perhaps they'll fix it for 10.1.3. If you have audio problems, please do report them to Apple.


Why would I not want to do that?

A kind reader wrote to me and pointed out that there are valid reasons for the behavior of Apple's driver. Here are his own words:

The design does take into account if the machine is plugged in. The problem is that there is no way to know how much power the computer is actually drawing, so even if it's plugged in, that doesn't mean that you don't want to sleep the audio hardware. You want to sleep the audio hardware in some situations, and those are undetectable situations as far as the driver is concerned. This is the best design given the requirements.

If you have a lot of power using devices, like a couple of USB devices and a FireWire hard drive that you might want the audio hardware go to sleep. You might actually drain your battery while you're plugged into the wall because charger doesn't supply enough current for everything that's plugged into USB and FireWire, so the battery not only doesn't charge, but actually supplies some power and slowly drains.

[People who use your program should be] aware of the fact that they are potentially increasing their charging time, or not charging their battery at all, depending on what external devices they might have connected.

If you are concerned about your power usage, and would like to know more about it as it happens, then you might like to check out XBattery.

Keep in mind that, by default, KeepSoundAwake does allow your audio hardware to sleep when the machine is not getting AC power.


Exactly which Powerbooks have sleeping audio hardware?

Apple has published a knowledge base article, which includes a list of affected models.


How do I install KeepSoundAwake?

There are two parts to KeepSoundAwake: the background application ("KeepSoundAwake") and the preference pane ("KeepSoundAwake.prefPane").

Install the application by copying it onto your hard drive. Any location will do; you might like to put it either in

    /Applications 
or
    /Users/yourhomefolder/Applications 
Then open your System Preferences, choose Login, and add KeepSoundAwake to the list of Login items. Put it at or near the top of the list. You do not need to check the "Hide" box, as the application hides itself.

Install the preference pane by copying it to one of either

    /Library/PreferencePanes 
or
    /Users/yourhomefolder/Library/PreferencePanes 
You may then access the KeepSoundAwake preferences from the System Preferences panel. Note: If the PreferencePanes folder does not exist in your personal Library folder, you may create it.


How do I uninstall KeepSoundAwake?

Open your System Preferences, choose Login, and remove KeepSoundAwake from the list of Login items. Remove the application from your hard drive. Remove the preference pane from your hard drive. If you wish to stop a running copy of the program, you may tell application "KeepSoundAwake" to quit from AppleScript, you may force it to quit with the Process Viewer, or you may reboot.


How do I configure KeepSoundAwake?

Open your System Preferences, and choose KeepSoundAwake.

Allow Audio to Sleep When Unplugged
KeepSoundAwake can tell whether or not your Powerbook's charger is plugged in. When this box is checked (the default) KeepSoundAwake will not keep the audio hardware awake when the the charger is not plugged in (i.e., when you're running off your batteries).

Seconds Between "Silent Sounds"
KeepSoundAwake works by playing a "silent sound" every 20 seconds by default. If you find that some other period works better for you, you can tweak it here.


Are you sure it's not messing up my system?

The source code is included. I've been running it for months with no ill effect. However, no warranty is made. Here is the official license:

	Copyright (c) 2002, Jonathan Feinberg
	All rights reserved.

	Redistribution and use in source and binary forms, with or without
	modification, are permitted provided that the following conditions are
	met:

	*	Redistributions of source code must retain the above copyright
		notice, this list of conditions and the following disclaimer.
	*	Redistributions in binary form must reproduce the above copyright
		notice, this list of conditions and the following disclaimer in the
		documentation and/or other materials provided with the distribution.
	*	The name of the author may not be used to endorse or promote
		products derived from this software without specific prior written
		permission.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
	IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
	TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
	PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
	OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
	PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
	LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
	NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Who made that cool icon?

The icon was made by combining a couple of icons from the excellent "X-Ray" set, by Mikkel Madsen. I have distributed this modification of his work with his permission. Here is the copyright notice which accompanies his work. Go to his site!

Mac OS X Icons - MM Icons version 2.0

Creator: Mikkel Madsen

Legality:
These icons are Copyright 2001 MM Icon Design.
The icons contained in this set are intended for free,
   and non-commercial use ONLY.
These icons can only be distributed as freeware.
The read-me file must accompany the set at all times.
Do not redistribute altered verions of the set without permission.
The logos and names referenced by these icons are trademarks of
   their respective companies.
By downloading this file you are agreeing to be bound by the terms
   of this agreement.

2001 MM Icon Design  • www.mmicons.com • www.mmicondesign.com

 //  www.pixeleer.dk  •  mfm@pixeleer.dk  \\

Enjoy!!

Version History

1.3
2002-09-27
Fixed a memory leak that only manifests in Jaguar.

1.2
2002-04-07
Added preferences, including a spiffy new preference pane.
Added the ability to let audio sleep if the charger is not plugged in. Thanks, Paul Haddad.
Added user-settable preference for period (in seconds) of wake-ups. Thanks, "Ernest".

1.1
2002-04-05
Now responds to "quit" AppleEvent, so you can tell application "KeepSoundAwake" to quit. This is in response to a bug report from user Chris Buerli.

1.01
2002-02-20
Was attempting to catch SIGKILL, when I really wanted SIGTERM. Thanks to Geoff Coffey for the bug report.
Added cautionary note with reasons not to use KeepSoundAwake. Thanks to the kind reader who wrote in with the advice.

1.0
2002-02-12
Initial release.