› Forums › Speech Synthesis › Festival › Print out raw utterance Festival
- This topic has 9 replies, 2 voices, and was last updated 5 months, 2 weeks ago by Ramiz C.
-
AuthorPosts
-
-
February 17, 2024 at 23:19 #17535
Small hurdle which is causing me a little trouble.
This is from Korin’s Bulk Processing front-end synthandsavesentences.scm (https://speech.zone/forums/topic/bulk-processing-text-festival/)
I want to print out not just the flat_repr, but the raw utt too. Ive tried putting in this third line, trying to put lots of things in the brackets – can print all the relations, but all i want is the actual raw utterance in text form.
(define (myAfterSynthFlatPrint utt)
(format t “utt%.8d %s\n” globalUttNum (utt.flat_repr utt)) ; convert utterance structure to flat text repr and print
(format t “utt%.8d %s\n” globalUttNum (???)) ; print raw utterance
(set! globalUttNum (+ globalUttNum 1))) -
February 19, 2024 at 15:25 #17536
Aha, yes, the bit you’re looking for here is:
(utt.feat utt “iform”)
This will look up a feature called “iform” on the utterance object – this is the “input form” of the text for a Text style utterance object.
-
February 19, 2024 at 17:51 #17537
Now getting the error: {FND} Feature iform not defined
And i cant find any useful documentation online ;(;; A model for how to automate large scale synthesis-and-save
;; AUTHOR: Korin Richmond (korin@cstr.ed.ac.uk)
;; DATE: 09/02/2018
;;
;; (based on a script originally from 14.03.2004, also by Korin)(defvar globalUttNum 0)
(defvar globalSaveDir “./”) ; just defaults – can be overriden further on(define (myAfterSynthSave utt)
(set! uttfilename (format nil “utt%.8d.utt” globalUttNum))
(utt.save utt (path-append globalSaveDir uttfilename)) ; save the utterance structure;; or just selected relation(s)
; (set! segfilename (format nil “utt%.4d.segs” globalUttNum))
; (utt.save.relation utt “Segment” (path-append globalSaveDir segfilename) 1);; and/or the waveform…
; (set! wavfilename (format nil “utt%.4d.wav” globalUttNum))
; (utt.save.wave utt (path-append globalSaveDir wavfilename))
(set! globalUttNum (+ globalUttNum 1)))(define (myAfterSynthFlatPrint utt)
(format t “utt%.8d %s\n” globalUttNum (utt.flat_repr utt)) ; convert utterance structure to flat text repr and print
(format t “utt%.8d %s\n” globalUttNum (utt.feat utt “iform”)) ; print raw sentence
(set! globalUttNum (+ globalUttNum 1)))(define (SynthAndSaveSentences text savedir)
“(SynthAndSaveSentences TEXTFILE SAVEDIR)
Run Festival on the sentences found in TEXTFILE, saving selected
results of synthesis in corresponding files in directory SAVEDIR”
(set! globalUttNum 1)
(set! globalSaveDir savedir)
(set! after_synth_hooks myAfterSynthSave)
(tts_file text)
(set! after_synth_hooks nil))(define (SynthAndFlatPrintSentences text)
“(SynthAndFlatPrintSentences TEXTFILE)
Run Festival on the sentences found in TEXTFILE, then convert the linguistic
data structures resulting from front-end analysis to a flat string
representation, which is then printed to standard out.”
(set! globalUttNum 1)
(set! after_synth_hooks myAfterSynthFlatPrint)
(tts_file text)
(set! after_synth_hooks nil)) -
February 19, 2024 at 17:59 #17538
Hmm, that seems to suggest the feature is indeed not defined in the utterance structure. The easiest way to check what information is contained in your utterance structures would be to save one (or all) and post an example here (they are just a text file, so you can also view it yourself).
You’ll see in the code indications for how/where the utterance file should be saved – can you attach one of those here please?
-
February 19, 2024 at 18:31 #17539
Is this what you mean?
utt00000002 <{(1 dh i s )}{(1 s e n )(0 t @ n s )}{(1 i z )}{(1 i n )}{(0 dh @ )}{(1 m i )(0 d l! )}> _BB
-
February 19, 2024 at 18:38 #17540
im not sure how to do that
-
-
February 19, 2024 at 18:43 #17541
output of Token Relation
utt00000001 <{(1 dh i s )}{(1 i z )}{(0 dh @ )}{(1 f @@r s t )}{(1 s e n )(0 t @ n s )}> _BB
()
id _1 ; name This ; whitespace “” ; prepunctuation “” ;
id _2 ; name is ; whitespace ” ” ; prepunctuation “” ;
id _3 ; name the ; whitespace ” ” ; prepunctuation “” ;
id _4 ; name first ; whitespace ” ” ; prepunctuation “” ;
id _5 ; name sentence ; punc . ; whitespace ” ” ; prepunctuation “” ;
utt00000001 nil -
February 20, 2024 at 09:56 #17542
Look higher up in the scheme code:
(utt.save utt (path-append globalSaveDir uttfilename)) ; save the utterance structure
Festival help on utt.save:
festival> (utt.save
(utt.save UTT FILENAME TYPE)
Save UTT in FILENAME in an Xlabel-like format. If FILENAME is “-”
then print output to stdout. TYPE may be nil or est_ascii -
February 20, 2024 at 14:46 #17543
OK, so it turns out the (tts_file …) function used by this script creates utterances of the “Token” type, which doesn’t have the “iform” feature, so you can’t simply print that feature out unfortunately. Instead, you can just print out all the items in the Token relation.
Here’s some scheme code for that. If you add this “utt.print.tokens” function to the scheme file, you can then add a call to this to where the after-synth hooks print the flat utterance representation for each sentence.
(define (utt.print.tokens utt)
“(utt.print.tokens UTT)
Print tokens of UTT (items in Token relation) to standard out.”
(mapcar
(lambda (token)
(format t “%s ” (item.feat token ‘name)))
(utt.relation.leafs utt ‘Token))
(format t “\n”)
) -
February 20, 2024 at 17:08 #17544
Thank you Korin!
-
-
AuthorPosts
- You must be logged in to reply to this topic.