reanimate-1.0.0.0: Animation library based on SVGs.

Safe HaskellNone
LanguageHaskell2010

Reanimate.Voice

Description

Reanimate can automatically synchronize animations to your voice if you have a transcript and an audio recording. This works with the help of Gentle (https://lowerquality.com/gentle/). Accuracy is not perfect but it is pretty close, and it is by far the easiest way of adding narration to an animation.

Synopsis

Documentation

data Transcript Source #

Aligned transcript. Contains the transcript text as well as timing data for each word.

Instances
Show Transcript Source # 
Instance details

Defined in Reanimate.Voice

FromJSON Transcript Source # 
Instance details

Defined in Reanimate.Voice

data TWord Source #

Spoken word. Includes information about when it was spoken, its duration, and its phonemes.

Constructors

TWord 

Fields

Instances
Show TWord Source # 
Instance details

Defined in Reanimate.Voice

Methods

showsPrec :: Int -> TWord -> ShowS #

show :: TWord -> String #

showList :: [TWord] -> ShowS #

FromJSON TWord Source # 
Instance details

Defined in Reanimate.Voice

data Phone Source #

Phoneme type

Constructors

Phone 
Instances
Show Phone Source # 
Instance details

Defined in Reanimate.Voice

Methods

showsPrec :: Int -> Phone -> ShowS #

show :: Phone -> String #

showList :: [Phone] -> ShowS #

FromJSON Phone Source # 
Instance details

Defined in Reanimate.Voice

findWord :: Transcript -> [Text] -> Text -> TWord Source #

Locate the first word that occurs after all the given keys. An error is thrown if no such word exists. An error is thrown if the keys do not exist in the transcript.

findWords :: Transcript -> [Text] -> Text -> [TWord] Source #

Locate all words that occur after all the given keys. May return an empty list. An error is thrown if the keys do not exist in the transcript.

loadTranscript :: FilePath -> Transcript Source #

Loading a transcript does three things depending on which files are available with the same basename as the input argument: 1. If a JSON file is available, it is parsed and returned. 2. If an audio file is available, reanimate tries to align it by calling out to Gentle on localhost:8765/. If Gentle is not running, an error will be thrown. 3. If only the text transcript is available, a fake transcript is returned, with timings roughly at 120 words per minute.

fakeTranscript :: Text -> Transcript Source #

Fake transcript timings at roughly 120 words per minute.

splitTranscript :: Transcript -> [(SVG, TWord)] Source #

Convert the transcript text to an SVG image using LaTeX and associate each word image with its timing information.

annotateWithTranscript :: Transcript -> Scene s () Source #

Helper function for rendering a transcript.