Hi,
I’m brand new to Csound, so I’m probably misunderstanding the fout opcode.
I expected fout to record the output of an instrument for an entire score, but I don’t quite understand what its doing.
In this first example, there are four 1/4 notes. the output of fout (foutStem.wav) contains only the last event in the score (400hz pitch). The main output is 4 notes as expected.
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
; ==============================================
<CsInstruments>
sr = 96000
ksmps = 1
nchnls = 1
0dbfs = 1
instr 1
aEnv adsr 0.01, 0.2, 0, 0, 0
aVco poscil 0.5, p4
aVca = aVco * aEnv
fout "foutStem.wav", -1, aVca
outs aVca
endin
</CsInstruments>
; ==============================================
<CsScore>
i 1 0.00 0.3 100
i 1 0.50 0.3 200
i 1 1.00 0.3 300
i 1 1.50 0.3 400
e
</CsScore>
</CsoundSynthesizer>
In this second example, there are four 1/8 notes. This time the output of fout is all four pitches,
but they are distorted and not occurring at the right time. The main output is as expected.
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
; ==============================================
<CsInstruments>
sr = 96000
ksmps = 1
nchnls = 1
0dbfs = 1
instr 1
aEnv adsr 0.01, 0.2, 0, 0, 0
aVco poscil 0.5, p4
aVca = aVco * aEnv
fout "foutStem.wav", -1, aVca
outs aVca
endin
</CsInstruments>
; ==============================================
<CsScore>
i 1 0.00 0.3 100
i 1 0.25 0.3 200
i 1 0.50 0.3 300
i 1 0.75 0.3 400
e
</CsScore>
</CsoundSynthesizer>
Due to the different results, I’m having a hard time hacking an understanding here.
There is a sentence in the docs (fout):
Notice that, unlike out, outs and outq, fout does not zero the audio variable so you must zero it after calling it. If polyphony is to be used, you can use vincr and clear opcodes for this task.
But I don’t understand what it means to “zero” it. I’m not sure if that is the cause of my problem but it could be?