Re: do shell sounds
Re: do shell sounds
- Subject: Re: do shell sounds
- From: Bob Studer <email@hidden>
- Date: Fri, 26 Dec 2008 08:48:42 -0800
On Dec 26, 2008, at 5:37 AM, Robert Poland wrote:
I am trying to eliminate the time/overhead of opening an application
for a single sound.
According to "man" your suggestion still opens an application.
But "do shell script would open *two* processes -- the shell
interpreter and the command itself. Admittedly, GUI applications can
be a bit overweight by comparison, but Play Sound is fairly light
weight and I don't see much advantage to avoiding it in comparison to
the amount of resources required to actually play the sound. The
"afplay" command was suggested by another poster to the list, but I
would bet that there wouldn't be much difference in performance.
Besides, to quote the web site for Play Sound:
Play Sound is designed, from the ground up, to run all the time, in
the background. While idle, the Play Sound application uses 0% of
the CPU, and uses very little memory. Running in the background
allows Play Sound to process incoming play requests with lightning
speed. In fact, due to the system resources needed in Mac OS X to
launch applications, launching and quitting Play Sound each time you
want to play a sound places more load on your system than simply
leaving Play Sound running in the background!
So a penalty is paid only the first time a sound is played. Once it's
running, there's no need to run another process again. If you use "do
shell script" with the afplay command, you will be launching a shell
and the command *each time* a sound is played. After the first time,
only an AppleEvent sent by the "tell" statement would be required.
-Bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden