• 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: Getting list of installed TTS voices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting list of installed TTS voices


  • Subject: Re: Getting list of installed TTS voices
  • From: Jon Pugh <email@hidden>
  • Date: Mon, 7 Dec 2009 10:38:00 -0800

At 9:03 AM -0800 12/7/09, Jon Pugh wrote:
>		set i's contents to t's text 18 thru (17 + (ASCII number t's character 17))

I wondered why I'd done this part, so I looked into it and the Voice Description file contains the name at a fixed offset in the file.   However, it also contains a sample phrase, so I improved the script to use the sample phrase too.

Jon


to test_voice()
	set f to path to voices as Unicode text
	set l to list folder f without invisibles
	set voiceList to {}
	set phraseList to {}
	repeat with i in l
		set t to read file (f & i & ":Contents:Resources:VoiceDescription")
		set nameLength to ASCII number t's character 17
		set voiceName to t's text 18 thru (17 + nameLength)
		set phraseLength to ASCII number t's character 81
		set phrase to t's text 82 thru (81 + phraseLength)
		copy voiceName to end of voiceList
		copy phrase to end of phraseList
		log {voiceName, phrase}
	end repeat
	set v to choose from list voiceList with prompt "Please choose a voice:"
	if v is not false then
		set phrase to ""
		repeat with i from 1 to number of items of voiceList
			if item i of voiceList = item 1 of v then
				set phrase to item i of phraseList
				exit repeat
			end if
		end repeat
		say "This is a sample of " & v & ". " & phrase using v
		{item 1 of v, phrase}
	end if
end test_voice

test_voice()
 _______________________________________________
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: 
 >Getting list of installed TTS voices (From: Laura Burns <email@hidden>)
 >Re: Getting list of installed TTS voices (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: Getting list of installed TTS voices
  • Next by Date: Copying Hyperlinks in Apple's Mail app
  • Previous by thread: Re: Getting list of installed TTS voices
  • Next by thread: Re: Getting list of installed TTS voices
  • Index(es):
    • Date
    • Thread