1;;; Czech support for Festival Mbrola output module
2
3;; Copyright (C) 2003, 2004, 2005 Brailcom, o.p.s.
4
5;; Author: Milan Zamazal <pdm@brailcom.org>
6
7;; COPYRIGHT NOTICE
8
9;; This program is free software; you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation; either version 2 of the License, or
12;; (at your option) any later version.
13
14;; This program is distributed in the hope that it will be useful, but
15;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17;; for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with this program; if not, write to the Free Software
21;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
22
23
24(require 'czech)
25(require 'mbrola)
26
27(lts.ruleset
28 czech-mbrola-lts
29 ()
30 (( [ z o: ] = z o )
31  ;;;
32  ( [ # ] = # )
33  ( [ _ ] = _ )
34  ( [ a ] = a )
35  ( [ a: ] = a: )
36  ( [ b ] = b )
37  ( [ c ] = c )
38  ( [ c~ ] = c~ )
39  ( [ ch ] = ch )
40  ( [ ch* ] = ch* )
41  ( [ d ] = d )
42  ( [ d~ ] = d~ )
43  ( [ e ] = e )
44  ( [ e: ] = e: )
45  ( [ f ] = f )
46  ( [ g ] = g )
47  ( [ h ] = h )
48  ( [ i ] = i )
49  ( [ i: ] = i: )
50  ( [ j ] = j )
51  ( [ k ] = k )
52  ( [ l ] = l )
53  ( [ m ] = m )
54  ( [ n ] = n )
55  ( [ n* ] = n* )
56  ( [ n~ ] = n~ )
57  ( [ o ] = o )
58  ( [ o: ] = o: )
59  ( [ p ] = p )
60  ( [ r ] = r )
61  ( [ r~ ] = r~ )
62  ( [ r~* ] = r~* )
63  ( [ s ] = s )
64  ( [ s~ ] = s~ )
65  ( [ t ] = t )
66  ( [ t~ ] = t~ )
67  ( [ u ] = u )
68  ( [ u: ] = u: )
69  ( [ v ] = v )
70  ( [ z ] = z )
71  ( [ z~ ] = z~ )
72  ( [ dz ] = dz )
73  ( [ dz~ ] = dz~ )))
74
75(defvar czech-mbrola-translations
76  '(("#"   "_")
77    ("c"   "ts")
78    ("ch"  "x")
79    ("ch*" "x")
80    ("c~"  "tS")
81    ("d~"  "d'")
82    ("dz~" "dZ")
83    ("h"   "h\\")
84    ("n*"  "n")
85    ("n~"  "n'")
86    ("o:"  "o")
87    ("r~"  "r'")
88    ("r~*"  "r'")
89    ("s~"  "S")
90    ("t~"  "t'")
91    ("z~"  "Z")))
92
93(defvar czech-mbrola-phoneme-durations
94  '(
95    (#   0.25)
96    (_   0.01)
97    (a   0.05)
98    (a:  0.125)
99    (b   0.0752)
100    (c   0.095)
101    (c~  0.096)
102    (ch  0.08)
103    (ch* 0.08)
104    (d   0.05)
105    (d~  0.07)
106    (e   0.05)
107    (e:  0.13)
108    (f   0.08)
109    (g   0.05)
110    (h   0.05)
111    (i   0.06)
112    (i:  0.10)
113    (j   0.06)
114    (k   0.07)
115    (l   0.05)
116    (m   0.05)
117    (n   0.05)
118    (n*  0.05)
119    (n~  0.05)
120    (o   0.05)
121    (o:  0.1)
122    (p   0.05)
123    (r   0.05)
124    (r~  0.05)
125    (r~* 0.05)
126    (s   0.05)
127    (s~  0.05)
128    (t   0.08)
129    (t~  0.062)
130    (u   0.06)
131    (u:  0.12)
132    (v   0.05)
133    (z   0.07)
134    (z~  0.05)
135    (dz  0.05)
136    (dz~ 0.07)
137    ))
138
139(defvar czech-mbrola_database nil)
140
141(czech-proclaim-voice
142 (mbrola_cz2 (gender male))
143 "Czech voice provided by the Mbrola cz2 database."
144 (set! czech-phoneset-translation* czech-mbrola-translations)
145 (set! czech-phoneme-durations* czech-mbrola-phoneme-durations)
146 (set! czech-lts-extra-rules* '(czech-mbrola-lts))
147 (set! czech-volume-scale* 1.0)
148 (set! czech-after-analysis-hooks* (list czech-translate-phonemes))
149 (if czech-mbrola_database
150     (set! mbrola_database czech-mbrola_database)
151     (error "czech-mbrola_database variable not set"))
152 (Param.set 'Synth_Method MBROLA_Synth))
153
154(provide 'czech-mbrola)
155