I am trying to create a piece of code that will step through a string and play a sound event of every character but I am having some issues.
As media.play Event Sound() is by default asynchronous I am using the onComplete (or whatever it’s called) to ensure each character sound has finished before the next one starts. I am using a do while loop to iterate through the string so that it is only moved to the next character once the sound file for the current one has finished.
So it should play the sound file for each letter.
It plays it once and displays D it does not seem to call the function that it should on completion of playing the sound file.
local function playSinglePhoneme(postLetter)
wordToSpeak = “dog”
local len = string.len(wordToSpeak)
local counter = 1
local next = true
function playEquals()
print(“Entered playEquals()”)
media.playEventSound(sayEqualsSID)
counter = counter + 1
end
while counter < len + 1 do
character = string.sub (wordToSpeak, counter,counter)
if next == true then
next = false
print(character)
–increment()
media.playEventSound(speakLetterG[currentPageNo],playEquals)
end
end
end [import]uid: 5872 topic_id: 3760 reply_id: 303760[/import]
