Text to speech synched to video

Phil Davis revdev at pdslabs.net
Tue Nov 17 02:15:06 EST 2009


Hi -

Conceptually this isn't hard at all. Here's how it could work:

   1. Create a callback list for the movie. (Look up "callbacks" in the
      docs. "The callbacks" is a player property.) A callback list is a
      set of lines where each line contains two items: a movie time
      reference and the name of the handler to be called at that time.
   2. Organize your text so each "read segment" is on a line by itself.
   3. Create a handler to be called by the callbacks, that uses the
      "revSpeak" command to read the next line of a set of text lines.


Here's some "prototype" code (not tested, probably over-simplified):

The "callbacks" player property:

    500,"readNextLine"
    1155,"readNextLine"
    2306,"readNextLine"


I'm assuming the text to be read is brought into a local variable before 
the movie starts. Because of that, all the following code should be in 
the same script:

-- start of code ------------

local vMovieText

on playStarted
   put the uMovieText of this stack into vMovieText
   revLoadSpeech
end playStarted

on readNextLine
   revSpeak line 1 of vMovieText
   wait until revIsSpeaking() = false with messages
   delete line 1 of vMovieText
end readNextLine

on playStopped
   revUnloadSpeech
end playStopped

-- end of code -------------

I think that's about all you would need if you do it this way, and there 
are no doubt other ways. At any rate it gives you a starting point.

Phil Davis


revolution at duncansoftware.on-rev.com wrote:
> I need to have a text file read using the system's text to speech engine
> and have it synched to a video. No talking heads just description of the
> activity in the video but there would be periods where no speech is
> required, in other words, intermitent speech timed to the video. Along the
> lines of the old text tracks in QuickTime but what I want is speech
> tracks. Does such a thing exist? Anyone have any ideas on how I might go
> about  accomplishing this? To complicate things it needs to run on
> Windows, and OSX. Linux would be nice but not critical.

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list