sorta
Prev | Orchestra Opcodes and Operators | Next

## sorta

sorta — Sorts an array in ascending order.

## Description

Takes a numeric array (k or i-rate) and returns it sorted in ascending order.

## Syntax

    k/i[]sorta k/i[]  (k- or i-arrays )

## Examples

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

Example 922. Example of the sorta opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    -n
    </CsOptions>
    <CsInstruments>

    instr 1
     kArr[] fillarray 1,3,2,7,4
     kSorted[] sorta kArr
     kn = 0
     while kn < lenarray(kSorted) do
      printk2 kSorted[kn]
      kn += 1
     od
     turnoff
    endin

    </CsInstruments>
    <CsScore>
    i1 0 1
    </CsScore>
    </CsoundSynthesizer>

## See Also

sortd

## Credits

Author: Victor Lazzarini

New in version 6.09

Prev | Up | Next
socksend | Home | sortd