Debian Codegraph @

lib/voices/english/don_diphone/festvox/don_diphone.scm

raw symbols SCIP
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;; ;;
3 ;;; Centre for Speech Technology Research ;;
4 ;;; University of Edinburgh, UK ;;
5 ;;; Copyright (c) 1996,1997 ;;
6 ;;; All Rights Reserved. ;;
7 ;;; ;;
8 ;;; Permission is hereby granted, free of charge, to use and distribute ;;
9 ;;; this software and its documentation without restriction, including ;;
10 ;;; without limitation the rights to use, copy, modify, merge, publish, ;;
11 ;;; distribute, sublicense, and/or sell copies of this work, and to ;;
12 ;;; permit persons to whom this work is furnished to do so, subject to ;;
13 ;;; the following conditions: ;;
14 ;;; 1. The code must retain the above copyright notice, this list of ;;
15 ;;; conditions and the following disclaimer. ;;
16 ;;; 2. Any modifications must be clearly marked as such. ;;
17 ;;; 3. Original authors' names are not deleted. ;;
18 ;;; 4. The authors' names are not used to endorse or promote products ;;
19 ;;; derived from this software without specific prior written ;;
20 ;;; permission. ;;
21 ;;; ;;
22 ;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
23 ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
24 ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
25 ;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
26 ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
27 ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
28 ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
29 ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
30 ;;; THIS SOFTWARE. ;;
31 ;;; ;;
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33 ;;; Set up Donovan diphones
34 ;;;
35 ;;; Note in its current setting this voice requires OALD which is
36 ;;; free only for non-commercial use
37 ;;;
38
39 (defvar donovan_diphone_dir (cdr (assoc 'don_diphone voice-locations)))
40
41 (require 'mrpa_phones)
42 (require 'holmes_phones) ;; diphones are in Holmes, but we map from mrpa
43 (require 'pos)
44 (require 'phrase)
45 (require 'tobi)
46 (require 'f2bf0lr)
47 (require 'mrpa_durs) ;; average durations for mrpa phones
48 (require 'gswdurtreeZ)
49 (require_module 'donovan)
50
51 (setup_oald_lex)
52
53 (define (setup_don_diphone)
54 (Donovan_Init
55 (list
56 (list 'index_file (string-append donovan_diphone_dir "diphlocs.txt"))
57 (list 'diphone_file (string-append donovan_diphone_dir "lpcdiphs.bin"))
58 )))
59
60 (define (don_postlex_syllabics utt)
61 "(don_postlex_syllabics utt)
62 Becuase the lexicon is somewhat random in its used of syllable l n and
63 m this is designed to post process the output inserting schwa before
64 them. Ideally the lexicon should be fixed."
65 (mapcar
66 (lambda (s)
67 (if (and (member_string (item.name s) '("l" "n" "m"))
68 (string-equal "coda" (item.feat s "seg_onsetcoda"))
69 (not (member_string (item.feat s "p.name") '(l r)))
70 (string-equal "-" (item.feat s "p.ph_vc")))
71 (item.relation.insert
72 s 'SylStructure
73 (item.insert s (list "@") 'before)
74 'before)))
75 (utt.relation.items utt 'Segment)))
76
77 (define (voice_don_diphone)
78 "(voice_don_diphone)
79 Set up the current speaker to be British male RP speaker, LPC Donovan
80 diphones."
81 (voice_reset)
82 (Parameter.set 'Language 'britishenglish)
83 ;; Phone set
84 (PhoneSet.select 'mrpa)
85 (Parameter.set 'PhoneSet 'mrpa)
86 ;; Tokenization rules
87 (set! token_to_words english_token_to_words)
88 ;; POS tagger
89 (set! pos_lex_name "english_poslex")
90 (set! pos_ngram_name 'english_pos_ngram)
91 (set! pos_supported t)
92 (set! guess_pos english_guess_pos) ;; need this for accents
93 ;; Lexicon selection
94 (lex.select "oald")
95 (set! postlex_rules_hooks (list postlex_apos_s_check
96 don_postlex_syllabics))
97 ;; Phrase prediction
98 (Parameter.set 'Phrase_Method 'prob_models)
99 (set! phr_break_params english_phr_break_params)
100 ;; Accent and tone prediction
101 (set! int_tone_cart_tree f2b_int_tone_cart_tree)
102 (set! int_accent_cart_tree f2b_int_accent_cart_tree)
103 ;; F0 prediction
104 (set! f0_lr_start f2b_f0_lr_start)
105 (set! f0_lr_mid f2b_f0_lr_mid)
106 (set! f0_lr_end f2b_f0_lr_end)
107 (Parameter.set 'Int_Method Intonation_Tree)
108 (set! int_lr_params
109 '((target_f0_mean 135) (target_f0_std 30)
110 (model_f0_mean 170) (model_f0_std 34)))
111 (Parameter.set 'Int_Target_Method Int_Targets_LR)
112 ;; Duration prediction
113 (set! duration_cart_tree gsw_duration_cart_tree);
114 (set! duration_ph_info gsw_durs)
115 (Parameter.set 'Duration_Method Duration_Tree_ZScores)
116 (Parameter.set 'Duration_Stretch 1.0)
117 ;; Waveform synthesizer: Donovan LPC diphones
118 (Parameter.set 'Synth_Method Donovan_Synthesize)
119 (setup_don_diphone)
120
121 (set! after_synth_hooks
122 (lambda (utt)
123 (utt.wave.rescale utt 1.6)))
124
125 (set! current-voice 'don_diphone)
126 )
127
128 (proclaim_voice
129 'don_diphone
130 '((language english)
131 (gender male)
132 (dialect british)
133 (description
134 "This voice uses a very small and efficient pulse-excited LPC
135 diphone synthesis method. It was originally written by Steve
136 Isard. The front end uses the same British English lexicon,
137 intonation and duration methods as rab_diphone.")))
138
139 (provide 'don_diphone)