The Alternative Csound Reference Manual
Previous |  | Next

# downsamp

downsamp -- Modify a signal by down-sampling.

## Description

Modify a signal by down-sampling.

## Syntax

kr downsamp asig [, iwlen]

## Initialization

iwlen (optional) -- window length in samples over which the audio signal is averaged to determine a downsampled value. Maximum length is ksmps; 0 and 1 imply no window averaging. The default value is 0.

## Performance

downsamp converts an audio signal to a control signal by downsampling. It produces one kval for each audio control period. The optional window invokes a simple averaging process to suppress foldover.

## Examples

Here is an example of the downsamp opcode. It uses the files downsamp.orc and downsamp.sco.

Example 1. Example of the downsamp opcode.

    /* downsamp.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Create a noise signal at a-rate.
      anoise noise 20000, 0.2

      ; Downsample the noise signal to k-rate.
      knoise downsamp anoise

      ; Use the noise signal at k-rate.
      a1 oscil 30000, knoise, 1
      out anoise
    endin
    /* downsamp.orc */

    /* downsamp.sco */
    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for one second.
    i 1 0 1
    e
    /* downsamp.sco */

## See Also

diff, integ, interp, samphold, upsamp

## Credits

Example written by Kevin Conder.

Previous | Home | Next
divz | Up | dripwater