-odac ; activate real time sound output
sr = 44100
ksmps = 32
nchnls = 1
0dbfs = 1
giSine ftgen 0, 0, 2^12, 10, 1 ; a sine wave
giEnv ftgen 0, 0, 2^12, 9, 0.5, 1, 0 ; envelope shape: a half sine
instr 1
; read the envelope once during the note's duration:
aEnv poscil 1, 1/p3, giEnv
aSig poscil aEnv, 500, giSine ; audio oscillator
out aSig ; audio sent to output
endin
; 7 notes, increasingly short
i 1 0 2
i 1 2 1
i 1 3 0.5
i 1 4 0.25
i 1 5 0.125
i 1 6 0.0625
i 1 7 0.03125
f 0 7.1
e