;------------------------------------------------------------------ ; Beginners Classic Waveshapes and Spectra Demo ; by Reginald Bain April 2002 ;------------------------------------------------------------------ sr = 44100 ; Sample rate kr = 4410 ; Control rate ksmps = 10 ; Number of samples per control period nchnls = 2 ; Number of channels ;------------------------------------------------------------------ ; Instrument for complex tones with harmonic partial relationships ;------------------------------------------------------------------ instr 1 idur = p3 ; Duration iamp = p4 ; Amplitude ifqc = cpspch(p5) ; Convert pitch to frequency itable = p6 ; Waveform f-table number ienv = p7 ; Envelope shape number asig oscili iamp, ifqc, itable dispfft asig, idur, 512 kenv oscili 1, 1/idur, ienv ; Generate the envelope outs asig*kenv, asig*kenv ; Shape the signal with the envelope before output endin ;--------------------------------------------------------------- ; Instrument for nearly harmonic and inharmonic complex tones ;--------------------------------------------------------------- instr 2 idur = p3 ; Duration iamp = p4 ; Amplitude ifqc = cpspch(p5) ; Frequency in Hz. itable = p6 ; Waveform f-table number ienv = p7 ; Envelope shape number asig oscili iamp, ifqc * .01, itable ; Scale ifqc to work with GEN09 partial specification dispfft asig, idur, 512 kenv oscili 1, 1/idur, ienv ; Generate the envelope outs asig*kenv, asig*kenv ; Shape the signal with the envelope before output endin