(FILECREATED "25-Jul-84 21:17:58" {ERIS}<SPEECH>HALVORSEN>SPEECHFIX.;1 3069   

      changes to:  (VARS SPEECHFIXCOMS)
		   (FNS MEEF FOOBAR SPEECH.SYNTHSLICE SPEECH.SYNTHTRAJ))


(* Copyright (c)  by NIL. All rights reserved.)

(PRETTYCOMPRINT SPEECHFIXCOMS)

(RPAQQ SPEECHFIXCOMS ((FNS FOOBAR MEEF SPEECH.SYNTHSLICE SPEECH.SYNTHTRAJ)))
(DEFINEQ

(FOOBAR
  (LAMBDA (X)                                                (* kbr: "25-Jul-84 16:26")
    (FOR I FROM 1 TO (ARRAYSIZE X) DO (COND
					((>$ (ELT X I)
					     0.0)
					  (SETF (ELT X I)
						(x$ 26.38071 (LOG (ELT X I)))))
					((<$ (ELT X I)
					    0.0)
					  (SETF (ELT X I)
						(x$ 26.38071 (0-$ (LOG (0-$ (ELT X I)))))))
					(T (SETF (ELT X I)
						 0.0))))))

(MEEF
  (LAMBDA NIL                                                (* kbr: "25-Jul-84 16:33")
    (FOR I FROM 1 TO 10000 DO (SPEECH.BOUT S (FIXR (ELT X (+ 100 (IMOD I 100))))))))

(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))))
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (347 3047 (FOOBAR 357 . 776) (MEEF 778 . 980) (SPEECH.SYNTHSLICE 982 . 2229) (
SPEECH.SYNTHTRAJ 2231 . 3045)))))
STOP