Debian Codegraph @

en1/lib/voices/english/en1_mbrola/festvox/en1_mbrola.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 ;;; A voice using the Roger diphones (en1) database in MBROLA format
34 ;;; This uses the standard Roger top end and executes the external
35 ;;; mbrola program to form the waveform.
36 ;;;
37 ;;; Note this requires MBROLA which has its own licence different
38 ;;; from the one above
39 ;;;
40 ;;; To install
41 ;;; Get the mrbola programs and en1 database from
42 ;;; http://tcts.fpms.ac.be/synthesis/mbrola.html
43 ;;; 1) put the mbrola executable in festival/lib/etc/[OSTYPE]/
44 ;;; where [OSTYPE] is the os type of your installation, there
45 ;;; will already be a directory of the appropriate name in
46 ;;; festival/lib/etc/ after you have installed festival (if there
47 ;;; isn't just add mbrola to festival/lib/etc/ instead)
48 ;;; The directory you put it in should also contain audsp (the
49 ;;; the audio spooler) as that directory is already in Festival's
50 ;;; path.
51 ;;; 2) Unpack en1-980910.zip in
52 ;;; festival/lib/voices/english/en1_mbrola/
53 ;;; that should the directory above the directory where this file is
54 ;;;
55 ;;; call (voice_en1_mrbola) in festival to select the voice or
56 ;;; add to siteinit.scm
57 ;;; (set! voice_default 'voice_en1_mbrola)
58 ;;; to make it always select this voice as the default
59
60 (set! en1_mbrola_dir (cdr (assoc 'en1_mbrola voice-locations)))
61
62 (require 'mrpa_phones)
63 (require 'pos)
64 (require 'phrase)
65 (require 'tobi)
66 (require 'f2bf0lr)
67 (require 'mrpa_durs)
68 (require 'gswdurtreeZ)
69 (require 'mbrola)
70
71 (setup_oald_lex)
72
73 (define (en1_postlex_syllabics utt)
74 "(en1_postlex_syllabics utt)
75 Becuase the lexicon is somewhat random in its used of syllable l n and
76 m this is designed to post process the output inserting schwa before
77 them. Ideally the lexicon should be fixed."
78 (mapcar
79 (lambda (s)
80 (if (and (member_string (item.name s) '("l" "n" "m"))
81 (string-equal "coda" (item.feat s "seg_onsetcoda"))
82 ;; r wont exist for British English so this is OK
83 (string-equal "-" (item.feat s "p.ph_vc")))
84 ;; Insert a schwa in the Segment and SylStructure relations
85 (item.relation.insert
86 s 'SylStructure
87 (item.insert s (list "@") 'before)
88 'before)))
89 (utt.relation.items utt 'Segment)))
90
91 (define (voice_en1_mbrola)
92 "(voice_en1_mbrola)
93 Set up the current voice to be a British male RP (Roger) speaker using
94 the MBROLA en1 diphone set."
95 (voice_reset)
96 (Parameter.set 'Language 'britishenglish)
97 ;; Phone set
98 (Parameter.set 'PhoneSet 'mrpa)
99 (PhoneSet.select 'mrpa)
100 ;; Tokenization rules
101 (set! token_to_words english_token_to_words)
102 ;; POS tagger
103 (set! pos_lex_name "english_poslex")
104 (set! pos_ngram_name 'english_pos_ngram)
105 (set! pos_supported t)
106 (set! guess_pos english_guess_pos) ;; need this for accents
107 ;; Lexicon selection
108 (lex.select "oald")
109 (set! postlex_rules_hooks (list postlex_apos_s_check
110 en1_postlex_syllabics))
111 ;; Phrase prediction
112 (Parameter.set 'Phrase_Method 'prob_models)
113 (set! phr_break_params english_phr_break_params)
114 ;; Accent and tone prediction
115 (set! int_tone_cart_tree f2b_int_tone_cart_tree)
116 (set! int_accent_cart_tree f2b_int_accent_cart_tree)
117 ;; F0 prediction
118 (set! f0_lr_start f2b_f0_lr_start)
119 (set! f0_lr_mid f2b_f0_lr_mid)
120 (set! f0_lr_end f2b_f0_lr_end)
121 (Parameter.set 'Int_Method Intonation_Tree)
122 (set! int_lr_params
123 '((target_f0_mean 110) (target_f0_std 15)
124 (model_f0_mean 170) (model_f0_std 34)))
125 (Parameter.set 'Int_Target_Method Int_Targets_LR)
126 ;; Duration prediction -- use gsw durations
127 (set! duration_cart_tree gsw_duration_cart_tree)
128 (set! duration_ph_info gsw_durs)
129 (Parameter.set 'Duration_Method Duration_Tree_ZScores)
130 (Parameter.set 'Duration_Stretch 0.95)
131 ;; Waveform synthesizer: MBROLA en1 diphones
132 (Parameter.set 'Synth_Method MBROLA_Synth)
133 ;; Because we need an extra parameter in the new version of mbrola
134 ;; we add that parameter to the database "name"
135 (set! mbrola_progname "mbrola")
136 ;; Newer versions of mbrola require the -I flag
137 (set! mbrola_database
138 (format
139 nil
140 "-I %s%s %s%s "
141 en1_mbrola_dir "en1mrpa"
142 en1_mbrola_dir "en1/en1"
143 ))
144 ;; *OLD MBROLA* doesn't require the -I flag and does it by argumnent order
145 ;; uncomment the following if you are using an older version of mbrola
146 ; (set! mbrola_database
147 ; (format
148 ; nil
149 ; "%s%s %s%s "
150 ; en1_mbrola_dir "en1"
151 ; en1_mbrola_dir "en1mrpa"
152 ; ))
153
154 (set! current-voice 'en1_mbrola)
155 )
156
157 (proclaim_voice
158 'en1_mbrola
159 '((language english)
160 (gender male)
161 (dialect british)
162 (description
163 "This voice provides a British RP English male voice using the
164 MBROLA synthesis method. It uses a
165 modified Oxford Advanced Learners' Dictionary for pronunciations.
166 Prosodic phrasing is provided by a statistically trained model
167 using part of speech and local distribution of breaks. Intonation
168 is provided by a CART tree predicting ToBI accents and an F0
169 contour generated from a model trained from natural speech. The
170 duration model is also trained from data using a CART tree.")))
171
172 (provide 'en1_mbrola)
173