Sounds of silence
Sounds of silence
- Subject: Sounds of silence
- From: Chris Nebel <email@hidden>
- Date: Mon, 09 Apr 2001 22:43:37 -0700
- Organization: Apple Computer, Inc.
Christopher Nebel wrote:
>
> [localhost:~] tim% /usr/bin/osascript beep
>
>
>
> but I hear nothing (I do hear the beep in script debugger (which is so
>
> far flawless in classic box), so it is not the no sound in X bug).
>
>
Now this one is more interesting. It looks like sound triggered from a
>
particular process gets cut off when the process terminates.
>
Essentially, the script is quitting too quickly for you to hear the
>
beep -- if you add a "delay" call after the beep, then you'll hear it.
>
I'm not sure if this should be considered a bug or not -- I'll have to
>
ask the sound guys.
Turns out this is not a bug. I don't know if I'd go so far as to call it a
feature, but it's definitely working as designed. Sounds played from a
particular process in Mac OS X are cut off when the process terminates.
(One can view this as a good thing: imagine iTunes going completely nuts.
Now imagine killing the application -- ahh, blessed silence. If it didn't
work this way, you'd have no recourse but to pull the plug.)
Because "beep" always plays asynchronously, the script won't wait until the
beep finishes, and since it exits right after the command, you never hear
anything. This problem is not unique to osascript -- an applet that tried
to beep as the last thing it does would hit it, too. As a workaround, you
could either put a delay after the beep, or use some sort of "play sound"
addition that plays synchronously.
--Chris Nebel
AppleScript Engineering