(FILECREATED "28-Jul-84 18:41:42" {ERIS}<SPEECH>A.;1 8815 changes to: (VARS ACOMS) previous date: "27-Jul-84 14:49:43" {PHYLUM}<HALVORSEN>LISP>A.;5) (* Copyright (c) 1984 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT ACOMS) (RPAQQ ACOMS ((FNS ARRAY.TO.FILE INVERSELOGTRANSFORMATION LOGTRANSFORMATION MAKE.INVERSE.LOG.TABLE MAKE.LOG.TABLE SPEECH.BIN SPEECH.BOUT SPEECH.SYNTHSLICE SPEECH.SYNTHTRAJ SYNTHESIZE) (VARS INVERSELOGARRAY LOGARRAY))) (DEFINEQ (ARRAY.TO.FILE [LAMBDA (FILENAME) (* pkh: "28-Jul-84 17:39") (PROG (STREAM) (SETQ STREAM (OPENSTREAM (PACKFILENAME 'HOST '{ERIS} 'DIRECTORY '<SPEECH>WAVE> 'NAME FILENAME 'EXTENSION 'WAVE) 'OUTPUT 'OLD/NEW)) (for I from 1 to (OR (COND ([NOT (EQUAL 'NOBIND (EVALV 'CUTOFF] CUTOFF)) (ARRAYSIZE SPEECH.*WAVE*)) do (SPEECH.BOUT STREAM (ELT SPEECH.*WAVE* I))) (CLOSEF STREAM]) (INVERSELOGTRANSFORMATION [LAMBDA (LOGNUM) (* pkh: "27-Jul-84 13:12") (* The "Alto" speech board is not linear; we take the log of the synthesizer output (range -128 to 128) and multiply with 26.38071 to regain the correct dynamic range (=256)) (FIXR (COND ((>$ LOGNUM 0.0) (ANTILOG (FQUOTIENT LOGNUM 26.38071))) [(<$ LOGNUM 0.0) (0-$ (ANTILOG (0-$ (FQUOTIENT LOGNUM 26.38071] (T 0.0]) (LOGTRANSFORMATION [LAMBDA (CODE) (* pkh: "27-Jul-84 12:18") (* The "Alto" speech board is not linear; we take the log of the synthesizer output (range -128 to 128) and multiply with 26.38071 to regain the correct dynamic range (=256)) (FIXR (COND ((>$ CODE 0.0) (x$ 26.38071 (LOG CODE))) [(<$ CODE 0.0) (x$ 26.38071 (0-$ (LOG (0-$ CODE] (T 0.0]) (MAKE.INVERSE.LOG.TABLE [LAMBDA (MIN MAX) (* pkh: "27-Jul-84 15:28") (PROG ((INVERSELOGARRAY (ARRAY (ARRAYSIZE LOGARRAY) 'FIXP 0 1))) (for X from MIN to MAX as N from 1 do (SETA INVERSELOGARRAY N (INVERSELOGTRANSFORMATION X))) (RETURN INVERSELOGARRAY]) (MAKE.LOG.TABLE [LAMBDA (MIN MAX) (* pkh: "27-Jul-84 12:30") (PROG ((LOGARRAY (ARRAY (ADD1 (IDIFFERENCE MAX MIN)) 'FIXP 0 1))) (for X from MIN to MAX as N from 1 do (SETA LOGARRAY N (LOGTRANSFORMATION X))) (RETURN LOGARRAY]) (SPEECH.BIN [LAMBDA (STREAM) (* pkh: "27-Jul-84 18:19") (PROG (CODE) (* Comensate for "Alto" speech board format) (SETQ CODE (\BIN STREAM)) [COND ((> CODE 128) (* Get back the negatives) (SETQ CODE (IDIFFERENCE 128 CODE] (* Shift up for the array) (* The signal has range -128 128%, but the array for the log lookup is 1 to 257) (* Un logarithmitize) (SETQ CODE (FPLUS CODE 129)) (SETQ CODE (ELT INVERSELOGARRAY CODE)) (RETURN CODE]) (SPEECH.BOUT [LAMBDA (STREAM CODE) (* pkh: "28-Jul-84 16:44") (* Compensates for the special file format required by the "Alto" speech board) (PROG [(X (ELT LOGARRAY (IPLUS 129 CODE] (* The "Alto" speech board wants all positive (values; we put the negative output from the synthesizer (-1 to -128) in the 128 to 256 range)) [COND ((ILESSP X 0) (SETQ X (- 128 X] (\BOUT STREAM X) (RETURN X]) (SPEECH.SYNTHSLICE [LAMBDA (SLICE) (* edited: "25-Jul-84 14:28") (* SPEECH.WAVE created according to contents of SLICE We do 4 periods%, then fake the rest. *) (COND ((NULL SLICE) (SETQ SLICE SPEECH.SLICE))) (PROG (PERIOD0) (COEWAVE.INIT.COEFF SPEECH.COEFF) (COEWAVE.INIT.MEMORY SPEECH.MEMORY) (* PERIOD0 = glottal period. *) (SETQ PERIOD0 (/ SR (PVECTOR.F0 SLICE))) (COND ((ZEROP PERIOD0) (SETQ PERIOD0 100))) [for (N ← 1) by (+ N PERIOD0) while (< N (ARRAYSIZE SPEECH.WAVE)) as I from 1 to 4 do (PARCOE.PTC SLICE SPEECH.COEFF) (COEWAVE.CTW SPEECH.COEFF SPEECH.MEMORY SPEECH.WAVE N (IMIN (+ N PERIOD0 -1) (ARRAYSIZE SPEECH.WAVE] [for N from (1+ (x 4 PERIOD0)) to (ARRAYSIZE SPEECH.WAVE) do [SETF (ELT SPEECH.WAVE N) (ELT SPEECH.WAVE (+ (x 3 PERIOD0) (\ N PERIOD0] (COND (COEWAVE.TRACE (WDISPLAY.DRAWXY N (ELT SPEECH.WAVE N) COEWAVE.WINDOW] (RETURN SPEECH.WAVE]) (SPEECH.SYNTHTRAJ [LAMBDA (TRAJ) (* edited: "25-Jul-84 14:28") (* SPEECH.WAVE created according to contents of TRAJ *) (COND ((NULL TRAJ) (SETQ TRAJ SPEECH.TRAJ))) (PROG NIL (COEWAVE.INIT.COEFF SPEECH.COEFF) (COEWAVE.INIT.MEMORY SPEECH.MEMORY) (* Synthesize%, updating SPEECH.COEFF every 50 samples *) [for (N ← 1) by (+ N 50) while (< N (ARRAYSIZE SPEECH.WAVE)) do (PARCOE.INTERPOLATE N TRAJ SPEECH.SLICE) (PARCOE.PTC SPEECH.SLICE SPEECH.COEFF) (COEWAVE.CTW SPEECH.COEFF SPEECH.MEMORY SPEECH.WAVE N (IMIN (+ N 49) (ARRAYSIZE SPEECH.WAVE] (RETURN SPEECH.WAVE]) (SYNTHESIZE [LAMBDA (TRANSCRIPTION OUTTOFILEFLG) (* pkh: "28-Jul-84 18:15") (PROG (STREAM) (SETQ USER.TRAJS (SPEAK TRANSCRIPTION)) (SPEECH.TEST) (SETQ STREAM (OPENSTREAM (PACKFILENAME 'HOST '{ERIS} 'DIRECTORY '<SPEECH>WAVE> 'NAME TRANSCRIPTION 'EXTENSION 'WAVE) 'OUTPUT 'OLD/NEW)) (for I from 1 to (OR (COND ([NOT (EQUAL 'NOBIND (EVALV 'CUTOFF] CUTOFF)) (ARRAYSIZE SPEECH.*WAVE*)) do (SPEECH.BOUT STREAM (ELT SPEECH.*WAVE* I))) (CLOSEF STREAM]) ) (RPAQ INVERSELOGARRAY (READARRAY 257 (QUOTE FIXP) 1)) (-128 -123 -119 -114 -110 -106 -102 -98 -95 -91 -88 -84 -81 -78 -75 -72 -70 -67 -65 -62 -60 -58 -56 -54 -52 -50 -48 -46 -44 -43 -41 -40 -38 -37 -35 -34 -33 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -22 -21 -20 -19 -19 -18 -17 -17 -16 -15 -15 -14 -14 -13 -13 -12 -12 -11 -11 -10 -10 -10 -9 -9 -9 -8 -8 -8 -7 -7 -7 -7 -6 -6 -6 -6 -6 -5 -5 -5 -5 -5 -4 -4 -4 -4 -4 -4 -3 -3 -3 -3 -3 -3 -3 -3 -3 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 10 10 10 11 11 12 12 13 13 14 14 15 15 16 17 17 18 19 19 20 21 22 22 23 24 25 26 27 28 29 30 31 33 34 35 37 38 40 41 43 44 46 48 50 52 54 56 58 60 62 65 67 70 72 75 78 81 84 88 91 95 98 102 106 110 114 119 123 128 NIL ) (RPAQ LOGARRAY (READARRAY 257 (QUOTE FIXP) 1)) (-128 -128 -128 -127 -127 -127 -127 -127 -126 -126 -126 -126 -125 -125 -125 -125 -124 -124 -124 -124 -124 -123 -123 -123 -123 -122 -122 -122 -121 -121 -121 -121 -120 -120 -120 -120 -119 -119 -119 -118 -118 -118 -118 -117 -117 -117 -116 -116 -116 -115 -115 -115 -114 -114 -114 -113 -113 -112 -112 -112 -111 -111 -111 -110 -110 -109 -109 -108 -108 -108 -107 -107 -106 -106 -105 -105 -104 -104 -103 -103 -102 -102 -101 -100 -100 -99 -99 -98 -97 -97 -96 -95 -95 -94 -93 -92 -91 -91 -90 -89 -88 -87 -86 -85 -84 -83 -82 -80 -79 -78 -76 -75 -73 -71 -70 -68 -66 -63 -61 -58 -55 -51 -47 -42 -37 -29 -18 0 0 0 18 29 37 42 47 51 55 58 61 63 66 68 70 71 73 75 76 78 79 80 82 83 84 85 86 87 88 89 90 91 91 92 93 94 95 95 96 97 97 98 99 99 100 100 101 102 102 103 103 104 104 105 105 106 106 107 107 108 108 108 109 109 110 110 111 111 111 112 112 112 113 113 114 114 114 115 115 115 116 116 116 117 117 117 118 118 118 118 119 119 119 120 120 120 120 121 121 121 121 122 122 122 123 123 123 123 124 124 124 124 124 125 125 125 125 126 126 126 126 127 127 127 127 127 128 128 128 NIL ) (PUTPROPS A COPYRIGHT ("Xerox Corporation" 1984)) (DECLARE: DONTCOPY (FILEMAP (NIL (505 6750 (ARRAY.TO.FILE 515 . 1038) (INVERSELOGTRANSFORMATION 1040 . 1535) ( LOGTRANSFORMATION 1537 . 1995) (MAKE.INVERSE.LOG.TABLE 1997 . 2366) (MAKE.LOG.TABLE 2368 . 2702) ( SPEECH.BIN 2704 . 3505) (SPEECH.BOUT 3507 . 4098) (SPEECH.SYNTHSLICE 4100 . 5336) (SPEECH.SYNTHTRAJ 5338 . 6147) (SYNTHESIZE 6149 . 6748))))) STOP