;Jeffrey Tokar sr = 44100 ;sample rate kr = 4410 ;control rate ksmps = 10 ;(ksmps = sr/kr) nchnls = 2 ;number of channels ;my instrument instr 70 a1,a2 loscil p5, p4/100, p6 ;a sample-based wavetable synthesizer with looping ain3 foscil 1000, 440, 1, 2, 3, 3 ain oscil p4, 0.1, 2 ain1,ain2 loscil ain, p5, p6 ;a sample-based wavetable synthesizer with looping outs (a1+ain1+ain3)/3, (a2+ain2+ain3)/3 endin ;mono oscilator instr 72 ain loscil p4, p5, p6 ;a sample-based wavetable synthesizer with looping k1 linen 0.4, .01, p3, .01 ; control the amplitude argument of the oscillator a1 oscil k1, p5, 1 outs ain-a1,ain-a1 endin ;-------------------------------------- ; Granular Synthesis Instruments ; Coded by Hans Mikelson February 2000 ;-------------------------------------- ;-------------------------------------- ; Granular Synthesis Instrument 2 ;-------------------------------------- instr 2 idur = p3 ; Duration iamp = p4 ; Amplitude iptch = p5 ; Pitch iaoff = p6 ; Amplitude offset ipoff = p7 ; Pitch offset idens = p8 ; Density ifn = p9 ; Waveform iri = p10 ; Fade in time iro = p11 ; Fade out time igdtab = p12 ; Grain duration table iwnd = 2 ; Grain window function imxgdur = 1 ; Maximum grain duration ; Amplitude envelope to fade in and out kamp linseg 0, iri*idur, 1, (1-iri-iro)*idur, 1, iro*idur, 0 kgrn oscil 1, 1/idur, igdtab ; Grain duration envelope kpoff oscil iptch, 1/idur, ipoff ; Pitch offset envelope i1 = sr/ftlen(ifn) ;scaling to reflect sample rate and table length ; Amp, Pitch, Density, AmpOff, PitchOff, GrainDur, Fn, Window, ImgDur, [Grnd] agrnl grain iamp, iptch*i1, idens, iaoff, kpoff, kgrn, ifn, iwnd, imxgdur agrnr grain iamp, iptch*i1, idens, iaoff, kpoff, kgrn, ifn, iwnd, imxgdur aoutl = agrnl*kamp ; Scale left and right channels and output. aoutr = agrnr*kamp outs aoutl, aoutr endin