Hi,
I have a little problem with an instrument. I summed several detuned oscillators in a loop. I expected to hear a rich chorus sound, but all i get is one single oscillator. This is the simplified code:
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
seed 0
instr 1
;count of oscilators
icofosc=10
asum=0
loop:
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
icofosc-=1
if icofosc>0 igoto loop
out asum
endin
</CsInstruments>
<CsScore>
;GEN07 straight lines
f 4 0 1024 7 1 1024 -1
i1 0 5
e
</CsScore>
</CsoundSynthesizer>
I assume it has something to do with the loop or with the a-rate topic. When I rewrite it in this long manner, it works:
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
instr 1
asum=0
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
iChorusDetune linrand 2
asig oscil 1000,440+iChorusDetune,4
asum+=asig
out asum
endin
</CsInstruments>
<CsScore>
;GEN07 straight lines
f 4 0 1024 7 1 1024 -1
i1 0 5
e
</CsScore>
</CsoundSynthesizer>
I could be fine with the second approach, but what if I wanted to use a hundred oscillators? Why does the first example not work? Any help is appreciated.