Skip to content

isreleasing

Reports whether an instrument instance is in its release stage.

Syntax

releasing:b = isreleasing(voice)
releasing:B = isreleasing(voice)
releasing:B = isreleasing()
kReleasing = isreleasing()
releasing:b isreleasing voice
releasing:B isreleasing voice

Initialization and performance

voice is an Instr reference to an initialized instance. With this argument, a b output checks once at initialization and a B output checks on every control cycle. The result is true while that instance is releasing and false otherwise.

Use function-call syntax for the forms without an argument. They check the current instrument on every control cycle. A B output is boolean. A k output is 1 during release and 0 otherwise, as with release.

A release tail lets an instrument continue after its note-off. Use an envelope such as linsegr, or xtratim, to set the release length. The forms without an argument request a short release extension if the instrument has none, just as release does. Checking another instance does not extend that instance's duration.

This opcode requires a valid instance when you supply voice. It cannot check the validity of an uninitialized or deleted reference. It also does not report whether a note has already ended.

Examples

The note lasts 0.5 seconds, followed by a 0.2-second envelope release. The printed value changes from 0 to 1 when that release starts. It uses isreleasing.csd.

Detect a note release
<CsoundSynthesizer>
<CsOptions>
-odac -d -m0
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 1
0dbfs = 1

instr 1
  ; The envelope extends the note by 0.2 seconds for its release.
  aEnvelope linsegr 0, 0.01, 0.1, 0.2, 0
  aTone poscil aEnvelope, 440
  out aTone

  self:Instr = getinstance()
  releasing:B = isreleasing(self)
  if releasing then
    kReleasing = 1
  else
    kReleasing = 0
  endif
  printk2 kReleasing

  ; The form without an argument checks the current note too.
  kCurrent = isreleasing()
endin
</CsInstruments>
<CsScore>
i 1 0 0.5
e
</CsScore>
</CsoundSynthesizer>

See also

isactive, getinstance, release, linsegr, xtratim, Instrument definitions, instances and opcode objects

Credits

Author Victor Lazzarini.

New in Csound 7.