festvox / festival

Festival Speech Synthesis System
Other
386 stars 58 forks source link

item.relation.leafs not working as expected ? #7

Closed gopalakr closed 6 years ago

gopalakr commented 6 years ago

item.relation.leafs isn't working for me as expected on my installation.

Eg. For a specific word within an utterance, the command (item.relation.leafs (utt.relation.first utt1 'Word) 'SylStructure) is returning all the phonemes through the end of the utterance and not just those in the current word, which I thought was the intended usage of this function.

I had to modify the following function in $FESTDIR/lib/festival.scm to make it work as it should (working version is pasted underneath), but wondering if my assumption of the intent of this function is incorrect.


(define (item.relation.leafs si relname)
  "(item.relation.leafs item relname)
Return a list of the leafs of this item in this relation."
  (let ((ls nil)
        (ll si)
        (pl si))
    (while (item.relation.daughter1 pl relname)
        (set! pl (item.relation.daughter1 pl relname)))
    (while (item.relation.daughtern ll relname)
        (set! ll (item.relation.daughtern ll relname)))
    (while (and pl (not (equal? pl ll)))
           (set! ls (cons pl ls))
           (set! pl (item.next_leaf pl)))
    (set! ls (cons pl ls))
    (reverse ls)))
festvox commented 6 years ago

I understand the confusing you but item.relation.leafs is doing what its supposed to be doing even if that's not what you want. What I do for the case you want (all the phones in a word) is

(define (allphones_from_word i) (apply append (mapcar item.daughters (item.relation.daughters i 'SylStructure))))

(set! utt1 (SynthText "festival")) (set! w1 (utt.relation.first utt1 'Word))

(allphones_from_word w1) (mapcar item.name (allphones_from_word w1))