Csound Csound-dev Csound-tekno Search About

[Csnd] turnoff2 release mode misbehavior?

Date2012-09-03 04:22
FromTakahiko Tsuchiya
Subject[Csnd] turnoff2 release mode misbehavior?
Hi list, and developers,

I am making a MIDI instrument with a max voice allocation, using the [turnoff2] that kills the oldest voice when reaching 4 active voices. It works as expected when the release mode is set to 0 = immediate cut off, but when it’s set to allow the note release, all the voice gets turned off but with release. Is this a bug? (Csound v5.17.1)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 10
nchnls = 2
0dbfs = 1.0

gisine ftgen 1, 0, 4096, 10, 1

instr 1

kactive active 1
if kactive > 3 then
ireleaseMode = p5
turnoff2 1, 1, ireleaseMode
endif

iampgain = .3
kampenv madsr .01, 0, 1, 1
kamp = iampgain * kampenv
ifrq = cpspch(p4)
asig oscil kamp, ifrq, 1

outs asig, asig

endin

</CsInstruments>
<CsScore>
t 0 120
i1 0 5 8.00 0
i. 1 . 8.04 .
i. 2 . 8.07 .
i. 3 . 8.11 .
i. 4 . 8.14 .
s

t 0 120
i1 0 5 8.00 1
i. 1 . 8.03 .
i. 2 . 8.07 .
i. 3 . 8.10 .
i. 4 . 8.14 .
e

</CsScore>
</CsoundSynthesizer>