COMMENT ⊗ VALID 00088 PAGES C REC PAGE DESCRIPTION C00001 00001 C00007 00002 I. INTRODUCTION C00014 00003 < The score, acknowledgements C00019 00004 < Modes, vocal source pitches, melodic motifs C00020 00005 II. MIXDOWN CHART: C00021 00006 < Part 1 C00023 00007 < Part 2 C00026 00008 < Part 3 C00029 00009 < Part 5 C00033 00010 < Final mixdown C00034 00011 III. SYNTHESIS INSTRUMENTS: C00035 00012 < "REV" - normal, and phase shifted version for P3BL1 C00037 00013 < "BELL" - P1BL1, P2BL1, P3BL2 C00040 00014 < "OM1" - P2OM1-6, P3OM1, P5OM1-2 C00051 00015 < - Choral effect generator and parameter list C00055 00016 < "SRC" & "BNC" - P2EC1-4, P5EC1-4 C00057 00017 < - instrument code C00061 00018 < "BNG" - P3BL1, P3BL3, P7BNG C00063 00019 < "TRNS" - P3VO2 C00068 00020 < "TRNS2" - P3VO3-8 C00071 00021 < INSTRUMENTS FOR PART 4: C00073 00022 < REVs, and SPIN C00076 00023 < Functions and Arrays C00080 00024 < Procedures for OM type instruments C00082 00025 < OMM C00089 00026 < OM2 C00094 00027 < OM_A, OM_B, OM_C, Phasers C00101 00028 < BELLs C00107 00029 < BANGs, and JET C00110 00030 IV. "SCORE" DATA FOR SYNTHESIS INSTRUMENTS: C00111 00031 < P2OM1 C00113 00032 < ARRAY MODE1(32),MODE1B(16) C00117 00033 < P2BL1, P2OM2 C00120 00034 < P2OM2.SCR C00139 00035 < P2OM3 -- uses "MODE2" C00140 00036 < P2OM4 -- uses "MODE1B" C00141 00037 < P2OM4.SCR C00158 00038 < P2OM6 C00159 00039 < P2OM6.SCR C00176 00040 < P2BL2 C00177 00041 < P2EC1A,B,C C00181 00042 < P2EC2A,B C00185 00043 < P2EC3A,B,C,D,E C00190 00044 < P2EC4A,B,C C00194 00045 < P3BL1 C00197 00046 < P4OM1, P4BL1 C00199 00047 < P4OM2, P4BL2, P4BL3, P4CR1 C00201 00048 < P4OM3, P4OM4, P4OM5 C00203 00049 < P5OM1 C00204 00050 < P5OM2, P5BL1 C00206 00051 V. READIN INSTRUMENTS COMMON TO MANY FILES: C00207 00052 < READIN, READI2, READI3, READI4 C00213 00053 < Simple READIN instruments for mixing, scaling, and shaping files C00216 00054 < PANNER: < 1. Initialization, Reverberators C00220 00055 < 2. Instrument code C00224 00056 < 3. Parameter list and READIN Instruments C00227 00057 < SOUND PATHS: C00228 00058 < Special interpolating READIN for pitch shifting with examples (P3VO1) C00231 00059 VI. READIN PLAY FILES, "MIXSND" INPUT, OTHER READIN INSTRUMENTS C00232 00060 < OVRLAP C00233 00061 < P1MX1, P1CR2 C00236 00062 < P1MX2, P1VO2B-5B C00239 00063 < P1MX3 C00242 00064 < PT1, P2MX2, P2OM2B-4B C00244 00065 < P2OM2, P2OM3, P2OM4, P2MX3 C00246 00066 < P2CR1B C00247 00067 < P2VO1B, P2VO1 C00250 00068 < P2MX4, P2MX5, P2MX6B, P2MX6 C00253 00069 < P2CR2, PT2 C00256 00070 < P3CR1B, P3CR1 C00258 00071 < P3VO1A, P3VO3A-8A, P3VO3B-8B C00262 00072 < P3MX4, PT3 C00264 00073 < P5CR1A-C C00267 00074 < P5CR1D, P5CR1E C00271 00075 < P5CR1F C00274 00076 < P5VO1A-B, P5VO1C-D C00278 00077 < P5MX3B, P5MX3C, P3MX3 C00281 00078 < P5VO3B-8B C00282 00079 < P5MX4B, P5MX4, P5OM2B C00285 00080 < P5CR2B C00286 00081 < PITCH C00294 00082 < P5CR2C C00296 00083 < P5CR2 C00298 00084 < PT12, PT123, DREAM C00300 00085 VII. APPENDIX C00301 00086 < RANDC, ZDELAY, SDELAY C00306 00087 < COMB.SAI C00310 00088 C00314 ENDMK C⊗; I. INTRODUCTION *** IF YOU MUST XSPOOL THIS USE /FONT=GACL22 TO REDUCE NUMBER OF PAGES *** This document contains most of the source code used for the production of "Dreamsong", composed and generated during 1977 and 1978 at the Center for Computer Research in Music and Acoustics, Stanford University Artificial Intelligence Lab. Due to its length, comments are a bit sketchy, and I am assuming that the reader is familiar with the syntax of the programs SCORE, a playlist generating program by Leland Smith, and MUS10, and MUSIC5-like sound synthesis and processing program. Documentation for these programs can be found at SAIL in SCORE.LCS[MUS,DOC], MUS10.LCS[UP,DOC], and USEMUS.LCS[UP,DOC]. For those who are searching herein for the code behind some particular section of "Dreamsong", it is recommended that one first use the accompanying score to learn the name of the relevant file, and then check the mixdown chart on the following pages for the names of possible additional files which represent intermediate steps in the production of that section. The code which was in these files can then be found by looking them up on the directory pages. The composer will gladly answer further questions and provide more detailed explanations on request. N.B.: When one process was repeated several times with only slight or obvious parameter changes, the actual parameters are often only given for one specific example, in the interest of brevity. Also, a few things are missing due to lost or overwritten files, but all the processing and synthesis techniques used are definitely represented in some form. If you don't find what you want, look at the code for a similar event. The original digital recordings of Marilyn Barber made at CCRMA were edited using EDSND, a digital sound editing and display program by Loren Rush, to remove unwanted silences and noises. Pitches on some of the notes were then corrected to equal tempered frequencies by re-sampling using MUS10. The crowd noises were obtained using a conventional tape recorder, with two microphones hung from the cieling of Memorial Auditorium on the Stanford campus, and recording the intermission of a film showing. This tape was later digitized at CCRMA, and also was the source for the filtered speaking voices heard in Part 5. The sound analysis and processing program "S", by Andy Moorer, was used to analyze the spectral content of some of the soprano tones. Resynthesis was done in order to gain the precise control over the harmonic structure necessary for some of the more radical timbral transformations. An interpolating delay function, called ZDELAY, plays a very important, although not always obvious role in Dreamsong. It is used for choral effects, periodic phase shifting, comb filtering at precise frequencies, and doppler shifting. ZDELAY writes a source signal, recorded or synthesized, into a buffer array sample by sample and reads it out again at the end of the array. The signal is thus effectively delayed by the number of samples in the buffer. The actual delay length can be continuously varied, and if it is non-integral an interpolation is done between the two nearest samples. An accompanying function called SDELAY can be used to read out of the same buffer at a different location, thus providing extra "taps" on the delay line. If the delay is about one period of the waveform in length, varies sinusoidally, and is added back in to the original, the familiar "phase-shifer" effect is achieved. If the delay length is slightly larger and modulated by a controlled random function, a choral effect is achieved. A fixed delay length provides a comb filter, which can be used to give "pitch" to non-pitched sounds. ZDELAY and SDELAY were coded in the FAIL assembly language and added to MUS10 in the interest of efficiency, but versions are given in our algol-like music compiler code in the appendix. < The score, acknowledgements The score is intended to serve three main purposes: first, to provide a graphic display of the larger-scale structure of the piece; second, to serve as a more convenient source of information for the actual notes used; and thirdly, to act as a kind of index through which brave souls can attempt to find and decipher the code responsible for some of the events they heard. The score is divided into sound catagories analogously to an orchestral score. Each small section is labeled with a name which represents the final version of the sound file. The first 2 characters represent the part of the piece, the second 2 represent the sound class, and the last is the number of that event in that class for that section; e.g., P1CR2 means the second crowd noise event in part one. The code which produced P1CR2 can then be looked up on the directory page. Code responsible for earlier processing stages usually has the same name with an additional letter, e.g., P5CR1A → P5CR1B → P5CR1C → P5CR1. The parameters and scaling factors for the various stages of mixdown are also given when relevant. Some of the larger rhythmic proportions are determined by fibonacci relationships. These are indicated on the score with small numerals separated by vertical lines. No numeralogical significance is intended in their use; they were simply a convienient source of non-simple yet natural proportions. Some other rhythmic units are based on a sub-octave of a central pitch being used at the time. For example, the lowest pitch in P2EC1 is F4 = 349.23 Hz. Six octaves below that is 5.46 Hz., which is a period of .18 seconds. This time was used as the rate of echo for that section. The period two octaves below that, .73 seconds, is the starting rhythm of P2BL1. It is also the length of one quarter note in P2OM2. These kind of relationships are also indicated on the score. ********************************************************************** The composer wishes to thank the many people who wrote and taught him to use effectively the programs used in Dreamsong, who helped him over many conceptual and/or mathematical stumbling blocks, and who calmly gave him encouragement when he was mad as hell over some programming bug and wasn't going to take it anymore. In part: John Chowning, John Grey, Gareth Loy, Dick Moore, Andy Moorer, Robert Poor, Loren Rush, Bill Schottstaedt, Ken Shoemake, Julius Orion Smith, Leland Smith, Tovar, and Paul Wieneke. Thanks also to Stephen Volz who guided me up through the catwalks of Memorial Auditorium in order to make that beautiful recording of the crowd. And very special thanks to Marilyn Barber, who provided me with so much with so few notes. < Modes, vocal source pitches, melodic motifs II. MIXDOWN CHART: < Part 1 P1BL1A ----- P1BL1B -- (pan) | |-- P1BL1 -- | | P1BL1C ----- P1BL1D -- |-- P1MX1A ----- P1MX1 -- (pan) | (phasing) | | | | | P1CR3 --------------------------- | (30" crowd) | | | P1CR2A ----- P1CR2B -- | (20" crowd) (filtered)| | |-- P1MX2A ----- P1MX2 --------------| | (panned) | P1VO1 --------------- | | | | P1VO2A ----- P1VO2B ----- P1VO2 -- |--- PT1 (a.m.) (chorus) | | | | | | P1VO3A ----- P1VO3B ----- P1VO3 --| | | | | | | | P1VO4A ----- P1VO4B ----- P1VO4 --|--- P1MX3A ----- P1MX3 -- | (reverb) | | P1VO5A ----- P1VO5B ----- P1VO5 --| | | | P1VO6 ---------------------------- < Part 2 P2OM1 ------------------------------------------------------ | | | P2OM2A ----- P2OM2B ----- P2OM2 -- | (panned) (echos) | | | | | | P2OM3A ----- P2OM3B ----- P2OM3 --|-- P2MX3 ---------------| (panned) (echos) | | | | | | P2OM4A ----- P2OM4B ----- P2OM4 -- | (panned) (echos) | | | P2EC1 -- | | | | | | | P2EC2 --|-- P2MX1 -- | | | | | |-- P2MX2 ----------------------------| | | | P2EC3 -- | | | | | | | | P2BL1 --------------- |-- PT2 | | | P2CR1 -- | | | |-- P2MX4A ----- P2MX4 -- | | (panned) | | P2OM5 -- |-- P2MX5A ----- P2MX5 --| | (reshaped) | | | | | P2VO1 ---------------------------- | | | | P2OM6 -- | | | |-- P2MX6A ----- P2MX6B ----- P2MX6 ---------------| | (panned) (echos) | P2BL2 -- | | | | P2EC4 --------------- | | | |-- P2MX7 ---------------------------- | P2CR2A ----- P2CR2 -- < Part 3 P3BL1 ------------------------------------------------------------------- | | | P3CR1A ----- P3CR1B ----- P3CR1C ----- P3CR1 -- | (phased) (pan 1) (pan 2) | | |-- P3MX1 -- | | | | P3VO1A ----- P3VO1 ---------------------------- | | (panned) | | | | | | P3BL2 ---------------------------- | | | | | | | | | | | P3BL3 ----------------------------| | | | | | |-- P3MX2 ---------------| | | | | P3VO2A ----- P3VO2B ----- P3VO2 --| | | (chorus) (reverb) | | | | | | | | | P3OM1 ---------------------------- | |-- PT3 | | |-- P3MX4 -- | P3VO3A ----- P3VO3 -- | | | | | | | P3VO4A ----- P3VO4 --| | | | | | | | P3VO5A ----- P3VO5 --| | | | |-- P3MX3A ----- P3MX3 --------------- | P3VO6A ----- P3VO6 --| | | | P3VO7A ----- P3VO7 --| | | | P3VO8A ----- P3VO8 -- < Part 5 P5CR1A ----- P5CR1D -- (panned) | | P5CR1B ----- P5CR1E --|-- P5CR1 --------------- (panned) | | | | P5CR1C ----- P5CR1F -- | (panned) | |-- P5MX2 -------------- | | P5VO1A ----- P5VO1C -- | | (panned) | | | |-- P5VO1 -- | | P5VO1B ----- P5VO1D -- | | | (panned) |-- P5MX1 -- | | | P5VO2A ----- P5VO2 --------------- | (reverb) | | P5EC1 -- | (p3ec1 | | reversed)| | | | P5EC2 --| | |-- P5MX3A ----- P5MX3B ----- P5MX3C ----- P5MX3 ---------------| | ("chorus") (rev 1) (rev 2) | P5EC3 --| | | | | | P5EC4 -- | |-- PT5 | P5VO3A ----- P5VO3B -- | (chorus) | | | | P5VO4A ----- P5VO4B --| | (chorus) | | | | P5VO5A ----- P5VO5B --| | (chorus) | | |-- P5MX4A ----- P5MX4B ----- P5MX4C ----- P5MX4 --| P5VO6A ----- P5VO6B --| (phased) (rev 1) (rev 2) | (chorus) | | | | P5VO7A ----- P5VO7B --| | (chorus) | | | | P5VO8A ----- P5VO8B -- | (chorus) | | P5OM1 --------------- | | | | | P5OM1A ----- P5OM1B --|-- P5MX5 ----------------------------------------| (echos) | | | | P5BL1 --------------- | | | P5CR2A ----- P5CR2B ----- P5CR2C ----- P5CR2 --------------------------- (42" crowd) (filter) (+ D.T.) (phase rev) < Final mixdown PT1 -- | |-- PT12 -- | | PT2 -- |-- PT123 -- | | | | | | PT3 -------------- |-- DREAM | | | PT4 --------------------------| | | | PT5 -------------------------- III. SYNTHESIS INSTRUMENTS: < "REV" - normal, and phase shifted version for P3BL1 VARIABLE /DSIG; ARRAY D1(1601),D2(1867),D3(2053),D4(2251),D5(347),D6(113),D7(37), BUFF1(1100),BUFF2(700); ZERO(BUFF1); < Clear the arrays ZERO(BUFF2); INSTRUMENT REV; REV1(DSIG,1601,.802,D1); REV1(DSIG,1867,.773,D2); REV1(DSIG,2053,.753,D3); REV1(DSIG,2251,.753,D4); REV2(U1+U2+U3+U4,347,.7,D5); REV2(U5,113,.7,D6); REV2(U6,37,.7,D7); DSIG←0; OUTA←OUTA+DELAY(U7,1100,BUFF1); < Different first reflection times OUTB←OUTB+DELAY(U7, 700,BUFF2); END; ********************************************************************** < "REV" - phase shifted version - P3BL1 VARIABLE /DSIG,/PTR,/DE1,/DE2,/XX,/YY,/Dis; ARRAY D1(1601),D2(1867),D3(2053),D4(2251),D5(347),D6(113),D7(37),BUFF1(1000); ZERO(BUFF1); A3←B3←PTR←0; INSTRUMENT REV; REV1(DSIG,1601,.802,D1); REV1(DSIG,1867,.773,D2); REV1(DSIG,2053,.753,D3); REV1(DSIG,2251,.753,D4); REV2(U1+U2+U3+U4,347,.7,D5); REV2(U5,113,.7,D6); REV2(U6,37,.7,D7); DSIG←0; De1 ← 500 + RANDC(300, .53, A1,A2,A3); < "Curvy" RANDI, see appendix De2 ← 500 + RANDC(300, .43, B1,B2,B3); OUTA←OUTA+ZDELAY(U7,De1,1000,Buff1,Ptr); < Continuously varying phases OUTB←OUTB+SDELAY(U7,De2,1000,Buff1,Ptr); END; < "BELL" - P1BL1, P2BL1, P3BL2 COMMENT This complex FM instrument is set up to produce a cathedral-like bell sound. It uses 3 modulators, one with a complex wave, and 3 carriers, like 3 simple fm units in parallel. Note that the one with the inharmonic ratio actually contributes very little. Most of the characteristic sound comes from the combination of one harmonic spectrum with its fundamental at P3, and another harmonic spectrum with fundamental a just minor 10th above P3; ARRAY Syn,EnvFun,DampFun,IndFun,ModFun1(512); SYNTH(ModFun1); 2,1 3,.2 999; < Modulator 1 SYNTH(Syn);1,1 999; < Modulators 2 and 3, all carriers SEG(EnvFun); 1,1 .6,10 .3,25 0,100; SEG(DampFun); 1,1 1,97 0,99 0,100; SEG(IndFun); 1,1 .6,12 .4,25 .1,100; INSTRUMENT BELLA; VARIABLE /Dmpr, /Env; I_ONLY BEGIN P5←11; Rate2Samples THEN Switch ← 1; IF Switch = 1 THEN BEGIN Total ← Samples ← Switch ← 0; GETRMULT(R1,I); < get new formants FOR I←1 STEP 1 UNTIL 12 DO BEGIN OldAmp1[I] ← NewAmp1[I]; NewAmp1[I] ← R1[I] * CurShape1[I]; < Amps are a function of random formants Total ← Total + NewAmp1[I]; < and spectral envelope END; FOR I←1 STEP 1 UNTIL 12 DO BEGIN NewAmp1[I] ← NewAmp1[I] * P4 / Total; < amps are normalized to sum to P4 Diff1[I] ← NewAmp1[I] - OldAmp1[I]; END; END; IF P8=1 THEN BEGIN < Rate of formant shifting changes dynamically Rate ← P9 + COSCIL[10](P10-P9, 10*MAG/P11, P12); VALUE[10](Rate2Samples ← INT(SRATE*Rate)); END; VALUE[3](Switch2 ← 1); IF Switch2 = 1 THEN BEGIN < Amp interpolation Intr ← Samples / Rate2Samples; FOR I ← 1 STEP 1 UNTIL 12 DO Amp1[I] ← OldAmp1[I] + Diff1[I] * Intr; Switch2 ← 0; End; Samples ← Samples + 1; IF P7 = 1 THEN BEGIN < Attack noise AttAmp ← EXPEN[10](1, 10*MAG/.17, Rmp2); IF AttAmp > 0 THEN Att ← 1 + RANDH(.05*AttAmp, 4000*MAG); END; IF P17 = 1 THEN Gliss ← COSCIL[20]((P18-P3)*Att*MAG, 20*MAG/P19, P20); < glissando factor IF P21 = 1 THEN Vib ← COSCIL[20]((P22*P3)*Att*MAG, 20*MAG*P23, P24); < vibrato factor VALUE[10](Inc ← P3*Att*MAG + Gliss + Vib); < Increment depends on freq, att, gliss, vib COSCIL(Amp1[1], Inc, SYN); COSCIL(Amp1[7], 7*Inc, SYN); < Harmonics COSCIL(Amp1[2], 2*Inc, SYN); COSCIL(Amp1[8], 8*Inc, SYN); COSCIL(Amp1[3], 3*Inc, SYN); COSCIL(Amp1[9], 9*Inc, SYN); COSCIL(Amp1[4], 4*Inc, SYN); COSCIL(Amp1[10], 10*Inc, SYN); COSCIL(Amp1[5], 5*Inc, SYN); COSCIL(Amp1[11], 11*Inc, SYN); COSCIL(Amp1[6], 6*Inc, SYN); COSCIL(Amp1[12], 12*Inc, SYN); Env ← LINEN[10](1, P25/10, P26/10, P6/10, P5, Var); < Amplitude function ChorIn1 ← (U5+U6+U7+U8+U9+U10+U11+U12+U13+U14+U15+U16)*Env; END; < - Choral effect generator and parameter list ARRAY Buff1(400); < Buffer array INSTRUMENT CHOR1; VARIABLE /De1,/De2,/De3,/Ds1,/Ds2,/Ds3,/Del,/Pointer,Len; I_ONLY BEGIN Del←P3; Len←Length(Buff1); ZERO[Buff1]; Pointer←A3←B3←C3←0; END; De1 ← RANDC(Del, P4, A1,A2,A3); < Curvy RANDI, see appendix De2 ← RANDC(Del, 1.1*P4, B1,B2,B3); De3 ← RANDC(Del, 0.9*P4, C1,C2,C3); Ds1 ← ZDELAY(ChorIn1, De1, Len, Buff1, Pointer); < 3 copies produced Ds2 ← SDELAY(ChorIn1, De2, Len, Buff1, Pointer); Ds3 ← SDELAY(ChorIn1, De3, Len, Buff1, Pointer); OUTA ← OUTA + (ChorIn1+Ds1+Ds2+Ds3)*.5; END; ********************************************************************** COMMENT Parameters: P1: Begin time P2: Duration P3: Fundamental frequency P4: Peak Amplitude P5: Amplitude function P6: Duration of amplitude function (i.e., for doing multi-note phrases) P7: 1 = New note with attack, 0 = continuation of phrase (P6 = several notes long) P8: 1 = Change period of formant shifts dynamically P9: Formant shift time, function = 0 P10: Formant shift time, function = 1 P11: Duration of shift time function (e.g., might be less than P2, or = P6) P12: Formant shift time function P13: 1 = Change spectral envelope dynamically P14: Beginning spectral envelope (if P13 = 0, then fixed spectral envelope) P15: Ending spectral envelope P16: Duration of interpolation from P14 to P15 P17: 1 = glissando P18: Glissando note, function = 1 P19: Duration of glissando function P20: Gissando function P21: 1 = periodic vibrato P22: amount of vibrato, as percentage of P3, 0 ↔ 1 P23: Vibrato rate P24: Vibrato function P25: Amplitude envelope attack time (sometimes defaulted in I_ONLY block; P26: Amplitude envelope decay time ; SETMAG;1 6400 PLAY; CHOR1 0 6 50 .6; OM1 0 3 B/2 1000 Env1 6 1 1 1 .1 6 Rmp1 1 F1 F2 5.5 1 A/2 3 Gls1 1 .01 4 SYN; OM1 3 3 C 1000 Env1 6 0 1 1 .1 6 Rmp1 1 F1 F2 5.5 1 B/2 3 Gls1 1 .01 4 SYN; FINISH; < "SRC" & "BNC" - P2EC1-4, P5EC1-4 < Arrays of carrier/modulator scale factors for random selection of FM timbres SETMAG;2 25600 ARRAY cfmult,mfmult(9); cfmult[0] ← 1; mfmult[0] ← 1; cfmult[1] ← 1; mfmult[1] ← 2; cfmult[2] ← 1; mfmult[2] ← 3; cfmult[3] ← 2; mfmult[3] ← 1; cfmult[4] ← 2; mfmult[4] ← 3; cfmult[5] ← 2; mfmult[5] ← 5; cfmult[6] ← 3; mfmult[6] ← 1; cfmult[7] ← 3; mfmult[7] ← 2; cfmult[8] ← 3; mfmult[8] ← 4; ARRAY ramp, envf1, envf2, envf3(512); SEG(envf1); 0,1 .7,10 1,20 0,100; SYNTH(envf2); .5,1 999; SEG(envf3); 0,1 1,75 0,100; SEG(ramp); 0,1 1,100; SYNTH(F1);1,1 999; VARIABLE /siga,/sigb; ARRAY buff1(6000), buff2(3000), buff3(4180), buff4(2090); < typical echo buffer sizes ZERO(buff1); ZERO(buff2); ZERO(buff3); ZERO(buff4); < - instrument code < Simple FM instruments for sound sources INSTRUMENT SRCa; VARIABLE /Ind, MaxInd, /Env, ModFreq, /Mod, /Snd, Freq, Amp, /Vib; I_ONLY BEGIN Freq ← Cfmult[P5]*P3*Mag; ModFreq ← Mfmult[P5]*P3*Mag; Amp ← P4; MaxInd ← P6 * (605/P3); END; Vib ← 1;.4 THEN P18←P19←.2 ELSE P18←P19←.4*P2; CRUNCHARRAY(SHAPE,P10); IF P8=1 THEN BEGIN FOR Z←0 STEP 1 UNTIL 6 DO R4[Z]←ABS(RAND); FOR Z←0 STEP 1 UNTIL 7 DO RMULT4[Z]←GETRMULT(Z,R4); TOTAL←0; FOR Z←0 STEP 1 UNTIL 7 DO BEGIN NEWAMP4[Z]←P4*RMULT4[Z]*SHAPE[Z]; TOTAL←TOTAL+NEWAMP4[Z]; END; FOR Z←0 STEP 1 UNTIL 7 DO NEWAMP4[Z]←NEWAMP4[Z]*P4/TOTAL; FOR Z←0 STEP 1 UNTIL 6 DO R4[Z]←ABS(RAND); FOR Z←0 STEP 1 UNTIL 7 DO RMULT4[Z]←GETRMULT(Z,R4); SWITCH←1;SAMPLES←0;RATE←P5; ZERO(BUFF2); END; END; RATECHANGE←P5+COSCIL(P6-P5,MAG/P7,RATEF1); IF SAMPLES≥SRATE*RATE THEN SWITCH←1; IF SWITCH=1 THEN BEGIN TOTAL←0; FOR Z←0 STEP 1 UNTIL 7 DO BEGIN OLDAMP4[Z]←NEWAMP4[Z]; NEWAMP4[Z]←P4*RMULT4[Z]*SHAPE[Z]; TOTAL←TOTAL+NEWAMP4[Z]; END; FOR Z←0 STEP 1 UNTIL 7 DO NEWAMP4[Z]←NEWAMP4[Z]*(P4/TOTAL); RATE←RATECHANGE; SWITCH←SAMPLES←0;SWITCH2←1; END; IF SWITCH2=1 THEN R4[SAMPLES]←ABS(RANDH(1,SRATE*MAG)); IF SAMPLES=6 THEN BEGIN; SWITCH2←0; FOR Z←0 STEP 1 UNTIL 7 DO RMULT4[Z]←GETRMULT(Z,R4); END; FOR Z←0 STEP 1 UNTIL 7 DO AMP4[Z]←OLDAMP4[Z]+((NEWAMP4[Z]-OLDAMP4[Z])*(SAMPLES/(SRATE*RATE))); SAMPLES←SAMPLES+1; ZOSCIL(AMP4[0],P3*MAG,SYN); ZOSCIL(AMP4[1],2*P3*MAG,SYN); ZOSCIL(AMP4[2],3*P3*MAG,SYN);ZOSCIL(AMP4[3],4*P3*MAG,SYN); ZOSCIL(AMP4[4],5*P3*MAG,SYN);ZOSCIL(AMP4[5],6*P3*MAG,SYN); ZOSCIL(AMP4[6],7*P3*MAG,SYN);ZOSCIL(AMP4[7],8*P3*MAG,SYN); SWELL←COSCIL(1,MAG/P7,SWELLF1); ENV←LINEN(1,P18,P19,P2,P9,VA1); DIST←4/(SWELL*SWELL); SIG←(U1+U2+U3+U4+U5+U6+U7+U8)*ENV*SWELL; DE1← (P11/2)+RANDI((P11/2)*.8+CZOSCIL((P11/2)*.2,P12*MAG,SYN),P13*MAG); DE2← (P11/2)+RANDI((P11/2)*.8+CZOSCIL((P11/2)*.2,P14*MAG,SYN),P15*MAG); DE3← (P11/2)+RANDI((P11/2)*.8+CZOSCIL((P11/2)*.2,P16*MAG,SYN),P17*MAG); DS1 ← ZDELAY(SIG, DE1, LENGTH(BUFF2), BUFF2, PTR); DS2 ← SDELAY(SIG, DE2, LENGTH(BUFF2), BUFF2, PTR); DS3 ← SDELAY(SIG, DE3, LENGTH(BUFF2), BUFF2, PTR); OUTA←OUTA+(SIG+DS1)/DIST; OUTB←OUTB+(DS2+DS3)/DIST; SIGR←SIGR+(SIG+DS1)*.06 + (DS2+DS3)*.03; SIGL←SIGL+(SIG+DS1)*.03 + (DS2+DS3)*.06; END; < OM_A, OM_B, OM_C, Phasers < version of OM2 set up for phasing INSTRUMENT OM_A; VARIABLE /SWITCH,/SWITCH2,/SWITCH3,/SAMPLES,/ENV,/TOTAL,/Z,/SIG, /DE1,/DE2,/DE3,/DS1,/DS2,/DS3,/DEPTH1,/DEPTH2,/DEPTH3, /RATECHANGE,/RATE,/CALLRATE,/DIST,/SWELL,VA1,/PTR; I_ONLY BEGIN P11←600;P12←1.3;P13←0.7;P14←1.1;P15←0.8;P16←0.9;P17←1.0; INDR THEN BEGIN <***CHECK IF SMPL CNT IS EXCEEDED RD←0; RETURN(RD); END; IF CNT > INBUF THEN BEGIN RDSMPL(INF,INBT); <**** GET A NEW BUFFER WHEN NECESSARY CNT←0; END; RD←INF(CNT); <**** PUT VALUE OF SAMPLE INTO RD CNT←CNT+1; <**** UPDATE THE COUNTER RETURN(RD); END; <**** VALUE OF RD IS RETURNED IN READIN(RD) FUNCTION READI2(RD2); < ***** DUPLICATE OF 'READIN' ***** BEGIN IF SCNT2=0 THEN BEGIN PRINT "****READING ",INFIL2,".SND****"; GETIN2(IN2,INSR,INBT2,INCH,INMX,INDR2); PRNTIT(CNT2,INBT2,INDR2,INBUF2); END; SCNT2←SCNT2+1; IF SCNT2 > INDR2 THEN BEGIN RD2←0; RETURN(RD2); END; IF CNT2 > INBUF2 THEN BEGIN RDSMP2(IN2,INBT2); CNT2←0; END; RD2←IN2(CNT2); CNT2←CNT2+1; RETURN(RD2); END; FUNCTION READI3(RD3); BEGIN IF SCNT3=0 THEN BEGIN PRINT "****READING ",INFIL3,".SND****"; GETIN3(IN3,INSR,INBT3,INCH,INMX,INDR3); PRNTIT(CNT3,INBT3,INDR3,INBUF3); END; SCNT3←SCNT3+1; IF SCNT3 > INDR3 THEN BEGIN RD3←0; RETURN(RD3); END; IF CNT3 > INBUF3 THEN BEGIN RDSMP3(IN3,INBT3); CNT3←0; END; RD3←IN3(CNT3); CNT3←CNT3+1; RETURN(RD3); END; FUNCTION READI4(RD4); BEGIN IF SCNT4=0 THEN BEGIN PRINT "****READING ",INFIL4,".SND****"; GETIN4(IN4,INSR,INBT4,INCH,INMX,INDR4); PRNTIT(CNT4,INBT4,INDR4,INBUF4); END; SCNT4←SCNT4+1; IF SCNT4 > INDR4 THEN BEGIN RD4←0; RETURN(RD4); END; IF CNT4 > INBUF4 THEN BEGIN RDSMP4(IN4,INBT4); CNT4←0; END; RD4←IN4(CNT4); CNT4←CNT4+1; RETURN(RD4); END; < Simple READIN instruments for mixing, scaling, and shaping files INSTRUMENT RD1A; < Reads mono file, scales by a constant OUTA ← OUTA + READIN(RD)*P3; END; INSTRUMENT RD1B; OUTA ← OUTA + READI2(RD2)*P3; < 2nd file uses 2nd function (3rd would use END; < READI3(RD3), etc. INSTRUMENT RD2A; < Reads stereo file, scales by a constant OUTA ← OUTA + READIN(RD)*P3; OUTB ← OUTB + READIN(RD)*P3; END; INSTRUMENT RD2B; OUTA ← OUTA + READI2(RD2)*P3; OUTB ← OUTB + READI2(RD2)*P3; END; INSTRUMENT RD3A; < Reads mono file, scales by a function P6 VARIABLE /Var; I_ONLY BEGIN Var←0; END; LINEN(P3, P4, P5, P2, P6, Var); < LINEN = (Amp, Attack time, Decay time, OUTA ← OUTA + READIN(RD) * U1; < Total time, Amp function, pointer variable) END; INSTRUMENT RD3B; VARIABLE /Var; I_ONLY BEGIN Var←0; END; LINEN(P3, P4, P5, P2, P6, Var); OUTA ← OUTA + READI2(RD2) * U1; END; INSTRUMENT RD4A; < Reads stereo file, scales by a function P6 VARIABLE /Var; I_ONLY BEGIN Var←0; END; LINEN(P3, P4, P5, P2, P6, Var); < LINEN = (Amp, Attack time, Decay time, OUTA ← OUTA + READIN(RD) * U1; < Total time, Amp function, pointer variable) OUTB ← OUTB + READIN(RD) * U1; END; INSTRUMENT RD4B; VARIABLE /Var; I_ONLY BEGIN Var←0; END; LINEN(P3, P4, P5, P2, P6, Var); OUTA ← OUTA + READI2(RD2) * U1; OUTB ← OUTB + READI2(RD2) * U1; END; INSTRUMENT RD5A; < Simpler version where attack & decay times aren't needed FOSCIL(P3, MAG/P2, P4); < FOSCIL = (Amp, Increment, function) OUTA ← OUTA + READIN(RD) * U1; OUTB ← OUTB + READIN(RD) * U1; END; < PANNER: < 1. Initialization, Reverberators COMMENT This instrument receives a signal being read in and moves it around in stereo. Each call on the instrument moves the apparent location of the sound from one point on an X-Y coordinate system to another, following either a straight line or an arc. Both the reverberated and the direct signals are delayed, using ZDELAY, by the length of time corresponding to the "distance" the sound has to travel to the listener, who is assumed to be at the origin of the X-Y system (See diagram). This provides one with an automatic doppler shift. For straight lines, the starting and finishing points are given. For arcs, the center, radius, and starting and ending degrees are given. 0 degrees is the point on the circle with the lowest Y value. ; SETMAG; 2 25600 VARIABLE Dist2Samp,/Sig,/Ptr1,/Ptr2; Dist2Samp ← Srate/334;< converts meters (dist) to samples (delay) ARRAY DirBuff(1000),RevBuff(2000),Fx,Fy(512); ZERO(DirBuff); ZERO(RevBuff); SYNTH(Fx);99 1 1 180 0 999 < needed for doing circles SYNTH(Fy);99 1 1 270 0 999 <********************************************************************** < Reverberators VARIABLE /RDistA,/RDistAB,/RDistB,/Dsig,RevBufLen,/RevSig, /RevAmpA,/RevAmpAB,/RevAmpB,/RevA,/RevAB,/RevB; ARRAY D1(1601),D2(1867),D3(2053),D4(2251),D5(347),D6(113),D7(37); Lim THEN Env ← 0; OUTA ← OUTA + (Dsig/(1+3*Fdback)) * Env; END; SCORE input: RDFLT3 0 55; P2 .2 1,1 .2 2,2 .2 3,3 .2 5,5 .2 8,8; P3 1 0,7.99; P4 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P5 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P6 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P7 1 0,5.99; P8 .333 1,1 .333 2,2 .334 3,3; P9 .5 1,1 .5 2,2; P10 LIT/"; SCNT ← 0"; END; < P5CR1D, P5CR1E OUTFILE ← "P5CR1D.SND"; < Circle S1 PLAY; REVINIT←1; REV 0 64; PAN2 0 16 0 6.5 4.5 8 20 2.8 .2 C 270 1 15; Ptr1 ← Ptr2 ← 0; RDPAN1 0 62; INFILE ← "P5CR1A"; SCNT ← 0; PAN2 16 10 0 6.5 4.5 5 20 2.8 .2 C 270 1 15; PAN2 26 6 0 6.5 4.5 3 20 2.8 .2 C 270 1 15; PAN2 32 10 0 6.5 4.5 5 20 2.8 .2 C 270 1 15; PAN2 42 16 0 6.5 4.5 8 20 2.8 .2 C 270 1 15; PAN2 58 4 0 6.5 4.5 8 20 2.8 .2 C 270 1 15; FINISH; ********************************************************************** < P5CR1E OUTFILE ← "P5CR1E.SND"; < Star S1 PLAY; REVINIT←1; REV 0 58; PAN2 0 3 0 11 ,-2.8 2.8 20 2.8 .2 0 0 1 15; RDPAN1 0 56; INFILE ← "P5CR1B; SCNT ← 0; PAN2 3 3 ,-2.8 2.8 4.5 8 20 2.8 .2 0 0 1 15; PAN2 6 3 4.5 8 ,-4.5 8 20 2.8 .2 0 0 1 15; PAN2 9 3 ,-4.5 8 2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 12 3 2.8 2.8 0 11 20 2.8 .2 0 0 1 15; PAN2 15 2 0 11 ,-2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 17 2 ,-2.8 2.8 4.5 8 20 2.8 .2 0 0 1 15; PAN2 19 2 4.5 8 ,-4.5 8 20 2.8 .2 0 0 1 15; PAN2 21 2 ,-4.5 8 2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 23 2 2.8 2.8 0 11 20 2.8 .2 0 0 1 15; PAN2 25 1 0 11 ,-2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 26 1 ,-2.8 2.8 4.5 8 20 2.8 .2 0 0 1 15; PAN2 27 1 4.5 8 ,-4.5 8 20 2.8 .2 0 0 1 15; PAN2 28 1 ,-4.5 8 2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 29 1 2.8 2.8 0 11 20 2.8 .2 0 0 1 15; PAN2 30 2 0 11 ,-2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 32 2 ,-2.8 2.8 4.5 8 20 2.8 .2 0 0 1 15; PAN2 34 2 4.5 8 ,-4.5 8 20 2.8 .2 0 0 1 15; PAN2 36 2 ,-4.5 8 2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 38 2 2.8 2.8 0 11 20 2.8 .2 0 0 1 15; PAN2 40 3 0 11 ,-2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 43 3 ,-2.8 2.8 4.5 8 20 2.8 .2 0 0 1 15; PAN2 46 3 4.5 8 ,-4.5 8 20 2.8 .2 0 0 1 15; PAN2 49 3 ,-4.5 8 2.8 2.8 20 2.8 .2 0 0 1 15; PAN2 52 4 2.8 2.8 0 11 20 2.8 .2 0 0 1 15; FINISH; < P5CR1F OUTFILE ← "P5CR1F.SND"; < Star S2 PLAY; REVINIT←1; REV 0 63; PAN2 0 5 0 2 ,-2.8 10.2 20 2.8 .2 0 0 1 15; RDPAN1 0 61; INFILE ← "P5CR1C"; SCNT ← 0; PAN2 5 4 ,-2.8 10.2 4.5 5 20 2.8 .2 0 0 1 15; PAN2 9 3 4.5 5 ,-4.5 5 20 2.8 .2 0 0 1 15; PAN2 12 3 ,-4.5 5 2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 15 3 2.8 10.2 0 2 20 2.8 .2 0 0 1 15; PAN2 18 2 0 2 ,-2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 20 2 ,-2.8 10.2 4.5 5 20 2.8 .2 0 0 1 15; PAN2 22 2 4.5 5 ,-4.5 5 20 2.8 .2 0 0 1 15; PAN2 24 2 ,-4.5 5 2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 26 2 2.8 10.2 0 2 20 2.8 .2 0 0 1 15; PAN2 28 1 0 2 ,-2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 29 1 ,-2.8 10.2 4.5 5 20 2.8 .2 0 0 1 15; PAN2 30 1 4.5 5 ,-4.5 5 20 2.8 .2 0 0 1 15; PAN2 31 1 ,-4.5 5 2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 32 1 2.8 10.2 0 2 20 2.8 .2 0 0 1 15; PAN2 33 2 0 2 ,-2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 35 2 ,-2.8 10.2 4.5 5 20 2.8 .2 0 0 1 15; PAN2 37 2 4.5 5 ,-4.5 5 20 2.8 .2 0 0 1 15; PAN2 39 2 ,-4.5 5 2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 41 2 2.8 10.2 0 2 20 2.8 .2 0 0 1 15; PAN2 43 3 0 2 ,-2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 46 3 ,-2.8 10.2 4.5 5 20 2.8 .2 0 0 1 15; PAN2 49 3 4.5 5 ,-4.5 5 20 2.8 .2 0 0 1 15; PAN2 52 4 ,-4.5 5 2.8 10.2 20 2.8 .2 0 0 1 15; PAN2 56 5 2.8 10.2 0 2 20 2.8 .2 0 0 1 15; FINISH; < P5VO1A-B, P5VO1C-D ARRAY F7(512),Buffer(251); SEG(F1);0,1 1,25 1,50 0,75 0,100; SEG(F2);0,1 1,25 0,50 0,75 0,100; SEG(F3);0,1 0,25 1,50 0,75 0,100; SEG(F4);1,1 0,25 0,50 1,75 0,100; SEG(F5);1,1 1,25 0,50 1,75 0,100; SEG(F6);1,1 0,25 1,50 1,75 0,100; SEG(F7);0,1 0,20 .2,35 1,50 .2,65 0,80 0,100; INSTRUMENT RDCHO5; VARIABLE /Sig, /De1, /De2, /Ds1, /Ds2, /Inptr,Len,Dev,/Rate,/Env,/Att,/Dec,/Var; I_ONLY BEGIN IF P3<6 THEN BEGIN INFILE←"EFX1"; Dev←125; END; IF P3<5 THEN BEGIN INFILE←"DFX1"; Dev←125; END; IF P3<4 THEN BEGIN INFILE←"EFX2"; Dev←250; END; IF P3<3 THEN BEGIN INFILE←"DFX2"; Dev←250; END; IF P3<2 THEN BEGIN INFILE←"EFX3"; Dev←65; END; IF P3<1 THEN BEGIN INFILE←"DFX3"; Dev←65; END; IF P7<6 THEN P7 ← F6; IF P7<5 THEN P7 ← F5; IF P7<4 THEN P7 ← F4; IF P7<3 THEN P7 ← F3; IF P7<2 THEN P7 ← F2; IF P7<1 THEN P7 ← F1; Att ← (P4*P2)/(P4+P5+P6); IF Att<.05 THEN Att←.05; Dec ← (P6*P2)/(P4+P5+P6); IF Dec<.05 THEN Dec←.05; Inptr←A5←B5←Var←0; Len←LENGTH(Buffer); ZERO(Buffer); END; Sig ← READIN(RD); Rate ← 2 + COSCIL[5](4, 5*MAG/34, F7); De1←RANDC(Dev,Rate*MAG,A1,A2,A3,A4,A5); De2←RANDC(Dev,1.1*Rate*MAG,B1,B2,B3,B4,B5); Ds1 ← ZDELAY(Sig, De1, Len, Buffer, Inptr); Ds2 ← SDELAY(Sig, De2, Len, Buffer, Inptr); Env ← LINEN(.5, Att, Dec, P2, P7, Var); OUTA ← OUTA + (Sig+Ds1+Ds2)*Env; END; SCORE input: RDCHO5 0 34; P2 .2 .62,.62 .2 1.24,1.24 .2 1.86,1.86 .2 3.09,3.09 .2 4.94,4.94; P3 MOVE/17 4.00,5.99 0,5.99; P4 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P5 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P6 .125 1,1 .125 2,2 .125 3,3 .125 5,5 .125 8,8 .125 13,13 .125 21,21 .125 34,34; P7 1 0,5.99; P8 LIT/";SCNT←0"; END; <********************************************************************** < P5VO1C-D OUTFILE ← "P5VO1C.SND"; PLAY; REVINIT←1; REV 0 37.5; PAN2 0 35.870 4.5 6.5 4.5 6.5 20 2.8 .2 0 0 25600 25600; Ptr1 ← Ptr2 ← 0; RDPAN2 0 35.870 1.5; INFILE ← "P5VO1A"; < One set of Eb - Db voices SCNT ← 0; FINISH; < P5MX3B, P5MX3C, P3MX3 ARRAY BuffA,BuffB(276); ZERO(BuffA); ZERO(BuffB); SEG(F1);1,1 1,40 .5,80 1,100; INSTRUMENT RDCHO3; VARIABLE /SigA, /SigB,/De1,/De2,/De3,/De4, /Ds1,/Ds2,/Ds3,/Ds4, /Inptr,/Inptr2,Len,Dev,Rate,/Env,Dens,/V1; I_ONLY BEGIN Inptr←Inptr2←V1←A5←B5←C5←D5←0; Len←LENGTH(BuffA); Rate ← P3; Dev ← P4; END; SigA←READIN(RD); SigB←READIN(RD); De1←RANDC(Dev,Rate*MAG,A1,A2,A3,A4,A5); De2←RANDC(Dev,1.2*Rate*MAG,B1,B2,B3,B4,B5); De3←RANDC(Dev,.9*Rate*MAG,C1,C2,C3,C4,C5); De4←RANDC(Dev,1.1*Rate*MAG,D1,D2,D3,D4,D5); Ds1 ← ZDELAY(SigA, De1, Len, BuffA, Inptr); Ds1 ← Ds1 + SDELAY(SigA, De2, Len, BuffA, Inptr); Ds2 ← ZDELAY(SigB, De3, Len, BuffB, Inptr2); Ds2 ← Ds2 + SDELAY(SigB, De4, Len, BuffB, Inptr2); Env ← FOSCIL[10](.85, 10*MAG/P2, F1); OUTA ← OUTA + ( SigA + Ds1)*Env; OUTB ← OUTB + ( SigB + Ds2)*Env; END; SETMAG;2 25600; OUTFILE←"P5MX3B.SND"; PLAY; RDCHO3 0 28 2 275; INFILE←"P5MX3A"; SCNT←0; FINISH; ************************************************************ < P5MX3C, P5MX3 OUTFILE ← "P5MX3C.SND"; < Channel B placed on left side < P5MX3 = both channels placed PLAY; REVINIT←1; REV 0 28; PAN2 0 26,-2.8 2.8,-2.8 2.8 20 2.8 .2 0 0 25600 25600; Ptr1 ← Ptr2 ← 0; RDPAN4 0 26 1; INFILE ← "P5MX3B"; < P5EC1 - 4 SCNT ← 0; FINISH; < P5VO3B-8B ARRAY BuffA(300); ZERO(BuffA); INSTRUMENT RDCHO4; VARIABLE /SigA, /De1,/De2,/De3, /Ds1,/Ds2,/Ds3, /Inptr,Len,Dev,Rate,Dens; I_ONLY BEGIN Inptr←A5←B5←C5←0; Len←LENGTH(BuffA); Rate ← P3; Dev ← (SRATE/P4)*3.2; END; SigA←READIN(RD); De1←RANDC(Dev,Rate*MAG,A1,A2,A3,A4,A5); De2←RANDC(Dev,1.1*Rate*MAG,B1,B2,B3,B4,B5); De3←RANDC(Dev,.9*Rate*MAG,C1,C2,C3,C4,C5); Ds1 ← ZDELAY(SigA, De1, Len, BuffA, Inptr); Ds2 ← SDELAY(SigA, De2, Len, BuffA, Inptr); Ds3 ← SDELAY(SigA, De3, Len, BuffA, Inptr); OUTA ← OUTA + (SigA + Ds1 + Ds2 + Ds3) * .4; END; SETMAG;1 25600; < P5MX4B, P5MX4, P5OM2B SETMAG;2 25600; ARRAY BuffA,BuffB(72); ZERO(BuffA); ZERO(BuffB); SYNTH(F1);99 1 1 270 1 999 INSTRUMENT RDPHA3; VARIABLE /SigA, /SigB, /De1, /Ds1, /Ds2, /De2, /Inptr, /Inpt2, Len,Dev,Rate; I_ONLY BEGIN Ds1←Ds2←Inptr←Inpt2←0; Len←LENGTH(BuffA); Dev ← 70; END; SigA←READIN(RD); SigB←READIN(RD); De1 ← ZOSCIL(Dev, MAG/5, F1); De2 ← ZOSCIL(Dev, MAG/6, F1); Ds1 ← ZDELAY(SigA, De1, Len, BuffA, Inptr); Ds2 ← ZDELAY(SigB, De2, Len, BuffB, Inpt2); OUTA ← OUTA + (SigA+Ds1*.5)*.68; OUTB ← OUTB + (SigB+Ds1*.5)*.68; END; OUTFILE←"P5MX4B.SND"; PLAY; RDPHA3 0 23; INFILE←"P5MX4A"; P3VO3-8 SCNT←0; FINISH; ************************************************************ < P5MX4 SETMAG;2 25600 OUTFILE ← "P5MX4.SND"; PLAY; REVINIT←1; REV 0 23; PAN2 0 21 ,-2 2,-2 2 20 2.8 .15 0 0 10000 10000; Ptr1 ← Ptr2 ← 0; RDPAN4 0 21 1; INFILE ← "P5MX4A"; < Channel B is reverberated SCNT ← 0; RD2B 0 23 1; INFIL2 ← "P5MX4B"; Max THEN Max ← Samp; MaxLim THEN < Let's look for the peak now IF S2 = 0 THEN IF Samp > Peak THEN BEGIN Peak ← Samp; < update peak value Time2 ← Cnt; < note the time (in samples) END ELSE S2 ← 1; IF Samp < MinLim THEN < good time to figure out current frequency IF S2 = 1 THEN BEGIN TmpFreq ← SRATE / (Time2 - Time1); < new frequency value Freqs1[Cnt1] ← TmpFreq; IF TmpFreq > Avg*2 THEN Freqs1[Cnt1] ← Avg; IF TmpFreq < Avg/2 THEN Freqs1[Cnt1] ← Avg; Sum ← 0; FOR I ← 0 STEP 1 UNTIL 15 DO Sum ← Sum + Freqs1[I]; < take average of last 16 freqs Avg ← Sum/16; IF ABS(Freqs1[Cnt1] - Avg) < Freq_Window*Avg THEN