| 1 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 2 |
;;; ;; |
| 3 |
;;; Centre for Speech Technology Research ;; |
| 4 |
;;; University of Edinburgh, UK ;; |
| 5 |
;;; Copyright (c) 1996-1999 ;; |
| 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 MBROLA us1 database |
| 34 |
;;; This uses the standard kal/ked 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 |
;;; |
| 41 |
;;; To install |
| 42 |
;;; Get the mrbola programs and us1 database from |
| 43 |
;;; http://tcts.fpms.ac.be/synthesis/mbrola.html |
| 44 |
;;; 1) put the mbrola executable in festival/lib/etc/[OSTYPE]/ |
| 45 |
;;; where [OSTYPE] is the os type of your installation, there |
| 46 |
;;; will already be a directory of the appropriate name in |
| 47 |
;;; festival/lib/etc/ after you have installed festival (if there |
| 48 |
;;; isn't just add mbrola to festival/lib/etc/ instead) |
| 49 |
;;; The directory you put it in should also contain audsp (the |
| 50 |
;;; the audio spooler) as that directory is already in Festival's |
| 51 |
;;; path. |
| 52 |
;;; 2) put the us1 database is |
| 53 |
;;; festival/lib/voices/english/us1_mbrola/us1/us1 |
| 54 |
;;; that is unpack the us1-XXXXXX.zip file in this directory |
| 55 |
;;; 3) If you have an older version of mbrola you will need to change |
| 56 |
;;; the calling sequence for mbrola itself look below at *OLD MBROLA* |
| 57 |
;;; |
| 58 |
;;; call (voice_us1_mrbola) in festival to select the voice or |
| 59 |
;;; add to siteinit.scm |
| 60 |
;;; (set! voice_default 'voice_us1_mbrola) |
| 61 |
;;; to make it always select this voice as the default |
| 62 |
|
| 63 |
|
| 64 |
;;; We need to know where the MBROLA us1 database and usradio file is |
| 65 |
;;; You may need to change this unless you unpack this in |
| 66 |
;;; festival/lib/voices/english/us1_mbrola/ |
| 67 |
(set! us1_mbrola_dir (cdr (assoc 'us1_mbrola voice-locations))) |
| 68 |
(set! load-path (cons (path-append us1_mbrola_dir "festvox/") load-path)) |
| 69 |
|
| 70 |
(require 'radio_phones) |
| 71 |
(require 'pos) |
| 72 |
(require 'phrase) |
| 73 |
(require 'tobi) |
| 74 |
(require 'f2bf0lr) |
| 75 |
(require 'mrpa_durs) |
| 76 |
(require 'mbrola) |
| 77 |
|
| 78 |
(setup_cmu_lex) |
| 79 |
|
| 80 |
(define (us1_postlex_syllabics utt) |
| 81 |
"(us1_postlex_syllabics utt) |
| 82 |
Becuase the lexicon is somewhat random in its used of syllable l n and |
| 83 |
m this is designed to post process the output inserting schwa before |
| 84 |
them. Ideally the lexicon should be fixed." |
| 85 |
(mapcar |
| 86 |
(lambda (s) |
| 87 |
(if (and (member_string (item.name s) '("l" "n" "m")) |
| 88 |
(string-equal "coda" (item.feat s "seg_onsetcoda")) |
| 89 |
;; r wont exist for British English so this is OK |
| 90 |
(string-equal "-" (item.feat s "p.ph_vc"))) |
| 91 |
(item.relation.insert |
| 92 |
s 'SylStructure |
| 93 |
(item.insert s (list "@") 'before) |
| 94 |
'before))) |
| 95 |
(utt.relation.items utt 'Segment))) |
| 96 |
|
| 97 |
(define (voice_us1_mbrola) |
| 98 |
"(voice_us1_mbrola) |
| 99 |
Set up the current voice to be an American Female speaker using |
| 100 |
the MBROLA us1 diphone set." |
| 101 |
(voice_reset) |
| 102 |
(Parameter.set 'Language 'americanenglish) |
| 103 |
(require 'radio_phones) |
| 104 |
(Parameter.set 'PhoneSet 'radio) |
| 105 |
(PhoneSet.select 'radio) |
| 106 |
;; Tokenization rules |
| 107 |
(set! token_to_words english_token_to_words) |
| 108 |
;; POS tagger |
| 109 |
(require 'pos) |
| 110 |
(set! pos_lex_name "english_poslex") |
| 111 |
(set! pos_ngram_name 'english_pos_ngram) |
| 112 |
(set! pos_supported t) |
| 113 |
(set! guess_pos english_guess_pos) ;; need this for accents |
| 114 |
;; Lexicon selection |
| 115 |
(lex.select "cmu") |
| 116 |
(set! postlex_rules_hooks (list postlex_apos_s_check)) |
| 117 |
;; Phrase prediction |
| 118 |
(require 'phrase) |
| 119 |
(Parameter.set 'Phrase_Method 'prob_models) |
| 120 |
(set! phr_break_params english_phr_break_params) |
| 121 |
;; Accent and tone prediction |
| 122 |
(require 'tobi) |
| 123 |
(set! int_tone_cart_tree f2b_int_tone_cart_tree) |
| 124 |
(set! int_accent_cart_tree f2b_int_accent_cart_tree) |
| 125 |
|
| 126 |
(set! postlex_vowel_reduce_cart_tree |
| 127 |
postlex_vowel_reduce_cart_data) |
| 128 |
;; F0 prediction |
| 129 |
(require 'f2bf0lr) |
| 130 |
(set! f0_lr_start f2b_f0_lr_start) |
| 131 |
(set! f0_lr_mid f2b_f0_lr_mid) |
| 132 |
(set! f0_lr_end f2b_f0_lr_end) |
| 133 |
(Parameter.set 'Int_Method Intonation_Tree) |
| 134 |
(set! int_lr_params |
| 135 |
'((target_f0_mean 160) (target_f0_std 34) |
| 136 |
(model_f0_mean 170) (model_f0_std 34))) |
| 137 |
(Parameter.set 'Int_Target_Method Int_Targets_LR) |
| 138 |
;; Duration prediction |
| 139 |
(require 'usdurtreeZ) |
| 140 |
(set! duration_cart_tree us_duration_cart_tree) |
| 141 |
(set! duration_ph_info us_durs) |
| 142 |
(Parameter.set 'Duration_Method Duration_Tree_ZScores) |
| 143 |
(Parameter.set 'Duration_Stretch 1.1) |
| 144 |
;; Waveform synthesizer: MBROLA us1 diphones |
| 145 |
(Parameter.set 'Synth_Method MBROLA_Synth) |
| 146 |
;; Because we need an extra parameter in the new version of mbrola |
| 147 |
;; we add that parameter to the database "name" |
| 148 |
(set! mbrola_progname "mbrola") |
| 149 |
;; Newer versions of mbrola require the -I flag |
| 150 |
(set! mbrola_database |
| 151 |
(format |
| 152 |
nil |
| 153 |
"-I %s%s %s%s " |
| 154 |
us1_mbrola_dir "usradio" |
| 155 |
us1_mbrola_dir "us1/us1" |
| 156 |
)) |
| 157 |
;; *OLD MBROLA* doesn't require the -I flag and does it by argumnent order |
| 158 |
;; uncomment the following if you are using an older version of mbrola |
| 159 |
; (set! mbrola_database |
| 160 |
; (format |
| 161 |
; nil |
| 162 |
; "%s%s %s%s " |
| 163 |
; us1_mbrola_dir "us1/us1" |
| 164 |
; us1_mbrola_dir "usradio" |
| 165 |
; )) |
| 166 |
|
| 167 |
(set! current-voice 'us1_mbrola) |
| 168 |
) |
| 169 |
|
| 170 |
(proclaim_voice |
| 171 |
'us1_mbrola |
| 172 |
'((language english) |
| 173 |
(gender male) |
| 174 |
(dialect american) |
| 175 |
(description |
| 176 |
"This voice provides a American English female voice using the |
| 177 |
MBROLA synthesis method. It uses a |
| 178 |
modified CMU lexicon for pronunciations. |
| 179 |
Prosodic phrasing is provided by a statistically trained model |
| 180 |
using part of speech and local distribution of breaks. Intonation |
| 181 |
is provided by a CART tree predicting ToBI accents and an F0 |
| 182 |
contour generated from a model trained from natural speech. The |
| 183 |
duration model is also trained from data using a CART tree."))) |
| 184 |
|
| 185 |
(provide 'us1_mbrola) |
| 186 |
|