• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: do shell sounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Thirteen Scripters Scripting (From: David Marshall <email@hidden>)
 >do shell sounds: was Thirteen Scripters Scripting (From: Robert Poland <email@hidden>)
 >Re: do shell sounds: was Thirteen Scripters Scripting (From: Bob Studer <email@hidden>)
 >Re: do shell sounds: was Thirteen Scripters Scripting (From: Robert Poland <email@hidden>)
 >Re: do shell sounds (From: Bob Studer <email@hidden>)
 >Re: do shell sounds (From: Robert Poland <email@hidden>)
 >Re: do shell sounds (From: Bob Studer <email@hidden>)

  • Prev by Date: Re: do shell sounds
  • Next by Date: Re: Things I thought I knew, but didn't - variable scope in repeat loops
  • Previous by thread: Re: do shell sounds
  • Next by thread: Re: Thirteen Scripters Scripting
  • Index(es):
    • Date
    • Thread