R
robotman
I'm creating a text-to-speach algorhythm in Excel which strings
together WAV files to form sentences. The concept works great, but I'm
needing to insert a delay between every word to let the system finish
saying the word before moving to the next one.
Using the code at the bottom of this post (plus a WAIT subroutine), I
need to do something like this:
PlaySound "this"
wait 0.5
PlaySound "is"
wait 0.3
PlaySound "a"
wait 0.3
PlaySound "test"
wait 0.5
** Is there any way to make the system wait until it is done playing a
WAV file before playing the next one so I don't need to figure out and
specify all the delays?
** What does "Alias" mean in the declaration?
** Can someone explain the parameters in "PlaySoundA" (i.e. lpszName,
hModule, dwFlags)?
Thanks!
John
___
Public Declare Function PlayWav Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_FILENAME = &H20000
___
Public Sub PlaySound(Optional SoundName As String =
"confirm_blip.wav")
On Error GoTo Skip_Sound
#If Win32 Then
Call PlayWav(ThisWorkbook.Path & "\SM Sounds\" & SoundName, 0&,
SND_FILENAME Or SND_ASYNC)
#End If
' Only can play sounds on PC
Skip_Sound:
End Sub
together WAV files to form sentences. The concept works great, but I'm
needing to insert a delay between every word to let the system finish
saying the word before moving to the next one.
Using the code at the bottom of this post (plus a WAIT subroutine), I
need to do something like this:
PlaySound "this"
wait 0.5
PlaySound "is"
wait 0.3
PlaySound "a"
wait 0.3
PlaySound "test"
wait 0.5
** Is there any way to make the system wait until it is done playing a
WAV file before playing the next one so I don't need to figure out and
specify all the delays?
** What does "Alias" mean in the declaration?
** Can someone explain the parameters in "PlaySoundA" (i.e. lpszName,
hModule, dwFlags)?
Thanks!
John
___
Public Declare Function PlayWav Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_FILENAME = &H20000
___
Public Sub PlaySound(Optional SoundName As String =
"confirm_blip.wav")
On Error GoTo Skip_Sound
#If Win32 Then
Call PlayWav(ThisWorkbook.Path & "\SM Sounds\" & SoundName, 0&,
SND_FILENAME Or SND_ASYNC)
#End If
' Only can play sounds on PC
Skip_Sound:
End Sub