| 1 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 2 |
;;; ;;; |
| 3 |
;;; Language Technologies Institute ;;; |
| 4 |
;;; Carnegie Mellon University ;;; |
| 5 |
;;; Copyright (c) 2000 ;;; |
| 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 |
;;; CARNEGIE MELLON UNIVERSITY 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 CARNEGIE MELLON UNIVERSITY 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 |
;;; Author: Alan W Black ([email protected]) ;;; |
| 34 |
;;; Date: September 2000 ;;; |
| 35 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 36 |
;;; ;;; |
| 37 |
;;; Display as we go synthesis ;;; |
| 38 |
;;; ;;; |
| 39 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 40 |
|
| 41 |
(defvar play_sync_program "/home/awb/projects/flite/testsuite/play_sync") |
| 42 |
|
| 43 |
(define (display_as_we_go file filemode) |
| 44 |
"(display_as_we_go file filemode) |
| 45 |
Display the words as we synthesize them." |
| 46 |
(set! tts_hooks |
| 47 |
(list utt.synth utt.play_display)) |
| 48 |
(tts_file file filemode) |
| 49 |
(format t "\n\n")) |
| 50 |
|
| 51 |
(define (utt.play_display utt) |
| 52 |
"(utt.play_display utt) |
| 53 |
Play and display." |
| 54 |
(let ((tmpwave (make_tmp_filename)) |
| 55 |
(tmpword (make_tmp_filename))) |
| 56 |
(utt.save.wave utt tmpwave 'riff) |
| 57 |
(utt.save.play_words utt tmpword) |
| 58 |
; (utt.save.segs utt tmpword) |
| 59 |
(system (format nil "%s %s %s" play_sync_program tmpwave tmpword)) |
| 60 |
(delete-file tmpwave) |
| 61 |
(delete-file tmpword) |
| 62 |
utt)) |
| 63 |
|
| 64 |
(define (utt.save.play_words utt filename) |
| 65 |
"(utt.save.play_words UTT FILE) |
| 66 |
Save words of UTT in a FILE in xlabel format, wityh added __silence__." |
| 67 |
(let ((fd (fopen filename "w"))) |
| 68 |
(format fd "#\n") |
| 69 |
(mapcar |
| 70 |
(lambda (w) |
| 71 |
(if (string-equal |
| 72 |
(item.feat w "R:SylStructure.daughter1.daughter1.R:Segment.p.name") |
| 73 |
(car (cadr (car (PhoneSet.description '(silences)))))) |
| 74 |
(format fd "%2.4f 100 %s\n" |
| 75 |
(item.feat w "R:SylStructure.daughter1.daughter1.R:Segment.p.end") |
| 76 |
"__silence__")) |
| 77 |
(format fd "%2.4f 100 %s\n" (item.feat w "word_end") |
| 78 |
(item.name w))) |
| 79 |
(utt.relation.items utt 'Word)) |
| 80 |
(fclose fd) |
| 81 |
utt)) |
| 82 |
|
| 83 |
|
| 84 |
(provide 'play_sync) |