1;;; Czech UniSyn based voice example definition
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;; Since there is currently no Czech UniSyn diphone database available, this
25;; file serves just as an example definition.
26
27
28(require 'czech)
29
30
31(define (czech-unisyn-dirname name)
32  (substring name 0 (- (length name) (+ 1 (length (basename name))))))
33
34(define (czech-unisyn-db-init name index-file)
35  (if (not (member name (us_list_dbs)))
36      (let ((lpc-dir (path-append (czech-unisyn-dirname
37                                   (czech-unisyn-dirname index-file))
38                                  "lpc")))
39        (us_diphone_init
40          (list (list 'name name)
41                (list 'index_file index-file)
42                (list 'grouped "false")
43                (list 'coef_dir lpc-dir)
44                (list 'sig_dir lpc-dir)
45                (list 'coef_ext ".lpc")
46                (list 'sig_ext ".res")
47                (list 'default_diphone "#-#"))))))
48
49(define (czech-unisyn-group-db-init name group-file)
50  (if (not (member name (us_list_dbs)))
51      (us_diphone_init
52        (list (list 'name name)
53              (list 'index_file group-file)
54              (list 'grouped "true")
55              (list 'default_diphone "#-#")))))
56
57(define (czech-unisyn-param-init)
58  (set! us_abs_offset 0.0)
59  (set! window_factor 1.0)
60  (set! us_rel_offset 0.0)
61  (set! us_gain 0.9)
62  (Parameter.set 'us_sigpr 'lpc))
63
64(define (czech-unisyn-init name index-file)
65  ((if (string-matches index-file ".*\.group$")
66       czech-unisyn-group-db-init
67       czech-unisyn-db-init)
68   name index-file)
69  (czech-unisyn-param-init)
70  (us_db_select name))
71
72
73;; Example definition
74; (czech-proclaim-voice
75;   foo
76;   "Foo Czech voice."
77;   (czech-unisyn-init 'czech_foo "/path/to/the/index/file"))
78
79
80(provide 'czech-unisyn)
81