(FILECREATED "11-Jul-84 15:33:40" {ERIS}<SPEECH>ROACH>SYNTH.FPKG;2 6545 changes to: (FNS SYNTH.GLUE SYNTH.OVERLAY SYNTH.OVERLAY1 SYNTH.INTERPOLATE)) (* Copyright (c) by NIL. All rights reserved.) (PRETTYCOMPRINT SYNTHCOMS) (RPAQQ SYNTHCOMS ((RECORDS TVPOINT2 TVPOINT) (FNS SYNTH.GLUE SYNTH.OVERLAY SYNTH.OVERLAY1 SYNTH.INTERPOLATE))) [DECLARE: EVAL@COMPILE (RECORD TVPOINT2 (TIME VALUE)) (RECORD TVPOINT (TIME VALUE M B)) ] (DEFINEQ (SYNTH.GLUE (LAMBDA (C1 V C2) (* kbr: "11-Jul-84 15:33") (* Glue C1%, V%, & C2 SEGMENTs to get TRAJ *) (PROG (DEFAULT DELTA PATH ANSWER) (SETQ ANSWER (CREATE PVECTOR TYPE ← 'TRAJ SOUND ← (PACK* (fetch (PVECTOR SOUND) of C1) (fetch (PVECTOR SOUND) of V) (fetch (PVECTOR SOUND) of C2)) CV ← 'CVC COMMENT ← ` (* Concatenation of (\COMMA (fetch (PVECTOR SOUND) of C1)) (\COMMA (fetch (PVECTOR SOUND) of V)) (\COMMA (fetch (PVECTOR SOUND) of C2)) *) )) (FOR PNAME IN PVECTOR.PNAMES DO (SETQ DEFAULT (PVECTOR.GET PVECTOR.DEFAULT PNAME)) (PVECTOR.PUT ANSWER PNAME (LIST (CREATE TVPOINT2 TIME ← 0 VALUE ← DEFAULT) (CREATE TVPOINT2 TIME ← 700 VALUE ← DEFAULT)))) (SYNTH.OVERLAY ANSWER V) (SYNTH.OVERLAY ANSWER C1) (* Adjust C2 to begin at the logic end of V. *) (SETQ C2 (COPYALL C2)) (SETQ DELTA (IDIFFERENCE (fetch (TVPOINT TIME) of (CAR (LAST (PVECTOR.GET V 'AV)))) 400)) (FOR PNAME IN PVECTOR.PNAMES DO (SETQ PATH (PVECTOR.GET C2 PNAME)) (FOR POINT IN PATH WHEN (NOT (IEQP (fetch (TVPOINT TIME) of POINT) 700)) DO (replace (TVPOINT TIME) of POINT with (IPLUS (fetch (TVPOINT TIME) of POINT) DELTA)))) (* Now overlay C2. *) (SYNTH.OVERLAY ANSWER C2) (RETURN ANSWER)))) (SYNTH.OVERLAY (LAMBDA (BUFFER S) (* kbr: "11-Jul-84 15:33") (* Overlay BUFFER with segment S. *) (PROG NIL (FOR PNAME IN PVECTOR.PNAMES WHEN (NOT (EQ PNAME 'SWITCH)) DO (SYNTH.OVERLAY1 BUFFER S PNAME))))) (SYNTH.OVERLAY1 (LAMBDA (BUFFER S PNAME) (* kbr: "11-Jul-84 15:33") (* Overlay BUFFER PNAME path with S PNAME path. *) (PROG (BPATH SPATH BPOINT EPOINT BTIME ETIME PATH VALUE) (SETQ BPATH (PVECTOR.GET BUFFER PNAME)) (SETQ SPATH (PVECTOR.GET S PNAME)) (COND ((NULL SPATH) (RETURN))) (SETQ BPOINT (CAR SPATH)) (SETQ EPOINT (CAR (LAST SPATH))) (SETQ BTIME (fetch (TVPOINT TIME) of BPOINT)) (SETQ ETIME (fetch (TVPOINT TIME) of EPOINT)) (* Points before overlay. *) (FOR POINT IN BPATH WHILE (ILESSP (fetch (TVPOINT TIME) of POINT) (SUB1 BTIME)) DO (PUSH PATH POINT)) (* Discontinuity *) (COND ((AND (NOT (IEQP BTIME 0)) (OR (NULL (fetch (TVPOINT M) of BPOINT)) (NOT (FEQP (fetch (TVPOINT M) of BPOINT) 1.0)) (NOT (FEQP (fetch (TVPOINT B) of BPOINT) 0.0)))) (PUSH PATH (CREATE TVPOINT2 TIME ← (SUB1 BTIME) VALUE ← (SYNTH.INTERPOLATE BPATH (SUB1 BTIME)))))) (* Overlaying points. *) (FOR POINT IN SPATH DO (COND ((NULL (fetch (TVPOINT M) of POINT)) (* No equation. *) (PUSH PATH POINT)) (T (* Equation *) (SETQ VALUE (SYNTH.INTERPOLATE BPATH (fetch (TVPOINT TIME) of POINT))) (SETQ VALUE (FPLUS (FTIMES (fetch (TVPOINT M) of POINT) VALUE) (fetch (TVPOINT B) of POINT))) (PUSH PATH (CREATE TVPOINT2 TIME ← (fetch (TVPOINT TIME) of POINT) VALUE ← VALUE))))) (* Discontinuity *) (COND ((AND (NOT (IEQP ETIME 700)) (OR (NULL (fetch (TVPOINT M) of EPOINT)) (NOT (FEQP (fetch (TVPOINT M) of EPOINT) 1.0)) (NOT (FEQP (fetch (TVPOINT B) of EPOINT) 0.0)))) (PUSH PATH (CREATE TVPOINT2 TIME ← (ADD1 ETIME) VALUE ← (SYNTH.INTERPOLATE BPATH (ADD1 ETIME)))))) (* Points after overlay. *) (FOR POINT IN BPATH WHEN (IGREATERP (fetch (TVPOINT TIME) of POINT) (ADD1 ETIME)) DO (PUSH PATH POINT)) (SETQ PATH (DREVERSE PATH)) (PVECTOR.PUT BUFFER PNAME PATH)))) (SYNTH.INTERPOLATE (LAMBDA (PATH TIME) (* kbr: "11-Jul-84 15:33") (PROG (LEFTPOINT RIGHTPOINT LTIME RTIME LVALUE RVALUE K VALUE) (FOR L IN PATH AS R IN (CDR PATH) WHEN (AND (ILEQ (fetch (TVPOINT TIME) of L) TIME) (IGEQ (fetch (TVPOINT TIME) of R) TIME)) DO (SETQ LEFTPOINT L) (SETQ RIGHTPOINT R) (RETURN)) (COND ((OR (NULL LEFTPOINT) (NULL RIGHTPOINT)) (PRINT '(Interpolation out of range)) (SHOULDNT))) (SETQ LTIME (fetch (TVPOINT TIME) of LEFTPOINT)) (SETQ RTIME (fetch (TVPOINT TIME) of RIGHTPOINT)) (SETQ LVALUE (fetch (TVPOINT VALUE) of LEFTPOINT)) (SETQ RVALUE (fetch (TVPOINT VALUE) of RIGHTPOINT)) (SETQ K (FQUOTIENT (FDIFFERENCE TIME LTIME) (FDIFFERENCE RTIME LTIME))) (SETQ VALUE (FPLUS (FTIMES K RVALUE) (FTIMES (FDIFFERENCE 1.0 K) LVALUE))) (RETURN VALUE)))) ) (DECLARE: DONTCOPY (FILEMAP (NIL (463 6523 (SYNTH.GLUE 473 . 2265) (SYNTH.OVERLAY 2267 . 2649) (SYNTH.OVERLAY1 2651 . 5443) (SYNTH.INTERPOLATE 5445 . 6521))))) STOP