select
Prev | Orchestra Opcodes and Operators | Next

## select

select — Select sample value based on audio-rate comparisons.

## Description

Select sample value from three based on audio-rate comparisons of two signals.

## Syntax

    aout select a1, a2, aless, aequal, amore

## Performance

a1, a2 -- audio signals that are compared.

aless -- audio signal selected if a1[n]<a2[n]

aequal -- audio signal selected if a1[n]=a2[n]

asig -- audio signal selected if a1[n]>a2[n]

The comparison is made sample by sample.

## Examples

Here is an example of the select opcode. It uses the file select.csd.

Example 951. Example of the select opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>

    <CsInstruments>
    nchnls = 3
    0dbfs = 1

    instr 1
      a1 oscil 0.8, 440
      a2 oscil 0.6, 880
      az = 0
      alow line -1, p3, -1
      ahigh line 1, p3, 1
      aout  select a1,a2,alow,az,ahigh
      outch 1, a1, 2,a2, 3,aout
      endin
    </CsInstruments>

    <CsScore>
    i1 0 5
    e
    </CsScore>

    </CsoundSynthesizer>

## See also

Miscellaneous opcodes

## Credits

By: John ffitch 2016

New in vesion 6.09

Prev | Up | Next
sekere | Home | semitone