Play .WAV files in Mac Excel VBA? TTS?

R

robotman

I'm setting up a Text-to-Speech algorhythm in VBA. On the Windows
platform, I can play .WAV files to accomplish what I'm doing.

Is there any way to play .WAV files in Excel VBA on the Mac?
Are there any built-in Text-To-Speech commands on the Mac?

Thanks.

John
 
J

JE McGimpsey

robotman said:
Are there any built-in Text-To-Speech commands on the Mac?

one way:

Const sMsg As String = """Hello World"""
MacScript ("say " & sMsg)
 
R

robotman

Const sMsg As String = """Hello World"""
MacScript ("say " & sMsg)

Can you point me to a webpage with parameters for "say" in Mac
script? (Since the word "say" is such a generic word, I can't find
the syntax for the "say" command.)

I'd like to play the sounds Synchronously (sp?) so the function
returns to the processor before finishing saying the word.

Thanks!

John
 
R

robotman

Const sMsg As String = """Hello World"""
MacScript ("say " & sMsg)

Can you point me to a webpage with parameters for "say" in Mac
script? (Since the word "say" is such a generic word, I can't find
the syntax for the "say" command.)

I'd like to play the sounds Synchronously (sp?) so the function
returns to the processor before finishing saying the word.

Thanks!

John
 
R

robotman

Actually I'm having trouble with the original MacScript suggestion.

Here's my code:

Option Explicit
Dim Soundname as string

Call Talk2Me "words I want to say"

__

Sub Talk2Me (SoundName as string)
SoundName = """ & SoundName & """
Macscript ("say " & SoundName)
End Sub
__


The Mac says "and soundname and" ... I can't get it to say the value
of the SoundName variable instead of the variable name. I'm sure it's
a quote thing...

Any help?!!

Thanks.

John
 
J

JE McGimpsey

robotman said:
Can you point me to a webpage with parameters for "say" in Mac
script? (Since the word "say" is such a generic word, I can't find
the syntax for the "say" command.)

I'd like to play the sounds Synchronously (sp?) so the function
returns to the processor before finishing saying the word.

MacScript sends its argument to, and gets any returned values from,
AppleScript - "say" is an AppleScript command from the Standard
Additions plug-in:

http://developer.apple.com/documentation/UserExperience/Conceptual/Speech
SynthesisProgrammingGuide/UsingSpeech/chapter_3_section_6.html
 
R

robotman

(google is burping a lot today! hope this thread isn't too
confusing...)

I have everything figured out except I'd like the function to return
the processor before finish playing the sound.

** Can someone point me to documentation on the "say" function on the
Mac? Specifically, on how I can play a sound synchronously (sp?) **

Thanks!

John
 
J

JE McGimpsey

robotman said:
Actually I'm having trouble with the original MacScript suggestion.

Here's my code:

Option Explicit
Dim Soundname as string

Call Talk2Me "words I want to say"

__

Sub Talk2Me (SoundName as string)
SoundName = """ & SoundName & """
Macscript ("say " & SoundName)
End Sub
__


The Mac says "and soundname and" ... I can't get it to say the value
of the SoundName variable instead of the variable name. I'm sure it's
a quote thing...

Not enough quotation marks (need to double them within a string, so

""""

produces, from the 2 internal quotation marks:

"

Try:

Public Sub try()
Call Talk2Me("words I want to say")
Call Talk2MeToo("words I want to say")
End Sub

Public Sub Talk2Me(ByVal SoundName As String)
MacScript ("say """ & SoundName & """")
End Sub

Public Sub Talk2MeToo(ByVal SoundName As String)
MacScript ("say " & Chr(34) & SoundName & Chr(34))
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top