; design by Ludo Smissaert
; ludo@ludikidee.com
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
instr 1
istep init 0 ;stap variable voor duur noot
iamp init p5 ;iamp rust : 0 geen rust dan p5
ipchstp init 0 ;stap variable, voor toon hoogen
muztbl:
itimetbl table istep, p6 ;de waarde van de noot
irusttbl table istep, p6 ;de waarde van de rusten afgeleid uit de zelfde tafel als "de waarde van de noot"
ienvtbl table istep, 102 ;envelop van de noot
ipchtbl table ipchstp, p4 ;de toon hoogte
ienvtbl = (ienvtbl == 0 ? 1 : ienvtbl) ;conditional
itimetbl = (itimetbl < 1 ? itimetbl*10 : itimetbl)
inoot = 1/itimetbl
iamp = (irusttbl < 1 ? 0 : p5) ;dit zorgt dat er een rust klinkt wanneer gewenst
asig1 pluck iamp/2, cpspch(ipchtbl), 2000, 0, 1
asig2 pluck iamp/2, cpspch(ipchtbl)*1.003, 2000*1.003, 0,1
asig = asig1 + asig2
timout 0, inoot, output
istep = istep+1 ;volgende stap uit de nootwaarden tafel
ipchstp = (irusttbl < 1 ? ipchstp : ipchstp+1) ;alleen volgende stap uit de pitch tafel als er een noot klinkt
reinit muztbl
output:
outs asig, asig
endin
instr 2
istep init 0 ;stap variable voor duur noot
iamp init p5 ;iamp rust : 0 geen rust dan p5
ipchstp init 0 ;stap variable, voor toon hoogen
muztbl:
itimetbl table istep, p6 ;de waarde van de noot
irusttbl table istep, p6 ;de waarde van de rusten afgeleid uit de zelfde tafel als "de waarde van de noot"
ienvtbl table istep, 102 ;envelop van de noot
ipchtbl table ipchstp, p4 ;de toon hoogte
ienvtbl = (ienvtbl == 0 ? 1 : ienvtbl) ;conditional
itimetbl = (itimetbl < 1 ? itimetbl*10 : itimetbl)
inoot = 1/itimetbl
iamp = (irusttbl < 1 ? 0 : p5) ;dit zorgt dat er een rust klinkt wanneer gewenst
if1 = cpspch(ipchtbl)
if2 = cpspch(ipchtbl)*.99
if3 = cpspch(ipchtbl)*1.01
kenv linseg 0, inoot/3, .5, inoot/3, 1, inoot/3, 0
kindx linseg 1, inoot/3, 3, inoot/3, 7, inoot/3, 1
a1 foscil iamp, if1, .0125, .5, kindx, 100
a2 foscil iamp, if2, .0125, .5, kindx, 100
a3 foscil iamp, if3, .0125, .5, kindx, 100
asig = (a1+a2+a3)*kenv
timout 0, inoot, output
istep = istep+1 ;volgende stap uit de nootwaarden tafel
ipchstp = (irusttbl < 1 ? ipchstp : ipchstp+1) ;alleen volgende stap uit de pitch tafel als er een noot klinkt
reinit muztbl
output:
outs asig, asig
endin
f100 0 4096 10 1
;reinitialization3.orc
;enveloppen
f1 0 512 5 1 250 .001 262 .001 ;kort
f2 0 512 5 1 512 .001;lang
;schrijf hieronder de noot waarden:
f101 0 32 -2 8 8 .8 8 .8 8 .8 8 .8 8 8 8 8 8 8 8
8 8 8 8 8 8 .8 8 .8 8 .8 8 8 8 8 8
8 8 8 8
f201 0 32 -2 .8 8 .8 8 .8 8 .8 8 8 8 .8 8 .8 8 .8 8
.8 8 .8 8 8 8 .8 8 .8 8 .8 8 8 8 .8 8
8 8 .8 8
;schriijf hieronder de toon enveloppen:
f102 0 32 -2 2 2 3 2 1 1 3 1 2 2 1 3 1 1 2 3 2 3 1 2 2 2 3 2
1 1 3 2 1 1 3 1
;schrijf hieronder de toon hoogtes:
f103 0 32 -2 8.01 8.03 8.06 8.01 8.10 8.08 8.10 8.01 8.10 8.01
8.03 8.08 8.10 8.03 8.01 8.06 8.08 8.06 8.10 8.08
9.01 8.10 8.08 8.06 8.03 8.01 8.03 9.01 9.03 9.01
8.01 8.01
;inst str dur pitch amp
;p1 p2 p3 p4 p5 p6 p7
i1 0 12 103 10000 101
i1 .25 12 103 10000 101
i1 .5 12 103 10000 101
i1 7 5 103 22000 201
f301 0 16 -2 8 8 .8 .8 8 8 .8 .8 .8 8 .8 8 8 8 .8 .8
;p1 p2 p3 p4 p5 p6
;ins str dur pchtbl amp ritmtbl
;i2 7 3 103 5000 201
;i2 7.25 4 103 2500 301
;i2 7.5 6 103 2500 201
;i2 8 2 103 5000 301
e