• 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: Thirteen Scripters Scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thirteen Scripters Scripting


  • Subject: Re: Thirteen Scripters Scripting
  • From: David Marshall <email@hidden>
  • Date: Thu, 25 Dec 2008 09:40:56 -0500

On Wed, 24 Dec 2008 16:19:28 -0700, Michelle Steiner wrote:

do shell script "say -v Alex " & theseThings

Why not this:

say theseThings using "Alex"

They both sound the same to me.  Is there any advantage to using the
shell script?

That's how I had it originally, until it was pointed out to me that the script consumed prodigious amounts of processor power. Further experimentation yielded these observations:


Whether run from Script Editor or from the Script menu, on my machine the 'say theseThings using "Alex"' version uses between 50 and 90% of a 1.25 GHz single processor CPU.

With the entire text output of the script selected in the Event Log, Script Editor menu -> Service -> Speech -> Start Speaking Text, no such processor spiking occurs, so it's not Text to Speech itself causing the overhead.

With the entire text output of the script selected in the Event Log and copied and pasted as a string literal in place of "theseThings" so that the whole script is reduced to

say [entire text output of the script pasted here] using "Alex",

the excessive processor load is back, so it's not the _code_ that's responsible. Ergo, it must be something in the relationship between AppleScript and Text to Speech.

So I tried

do shell script "say -v Alex " & theseThings

to test this hypothesis, and voila! No heavy CPU overhead. I'll leave it to someone less oblivious to Apple Events and platform architecture to explain these findings.

Thanks to everyone *cough*even Doug*cough* for the various improvements offered. ;-) Speaking of C, I do wish AppleScript included a "switch" statement and a "case" label:

switch (i) {
case 12: printf ("twelve drummers drumming,\n");
case 11: printf ("eleven pipers piping,\n");
case 10: printf ("ten lords a-leaping,\n");
case 9: printf ("nine ladies dancing,\n");
case 8: printf ("eight maids a-milking,\n");
case 7: printf ("seven swans a-swimming,\n");
case 6: printf ("six geese a-laying,\n");
case 5: printf ("five golden rings,\n");
case 4: printf ("four calling birds,\n");
case 3: printf ("three French hens,\n");
case 2: printf ("two turtle doves, and \n");
case 1: printf ("a partridge in a pear tree.\n"); break;
}

I like the elegant simplicitly of building a list of n items by "falling through" to the nth-1 item.

- - - - -

Dave
_______________________________________________
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
  • Follow-Ups:
    • do shell sounds: was Thirteen Scripters Scripting
      • From: Robert Poland <email@hidden>
    • Re: Thirteen Scripters Scripting
      • From: Michelle Steiner <email@hidden>
    • Re: Thirteen Scripters Scripting
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Things I thought I knew, but didn't - variable scope in repeat loops
  • Next by Date: Re: Thirteen Scripters Scripting
  • Previous by thread: Re: Things I thought I knew, but didn't - variable scope in repeat loops
  • Next by thread: Re: Thirteen Scripters Scripting
  • Index(es):
    • Date
    • Thread