linlin
Prev | Orchestra Opcodes and Operators | Next

## linlin

linlin — Linear to linear interpolation

## Description

Maps a linear range of values to another linear range of values.

## Syntax

    kout linlin kin, ksrclo, ksrchi, kdstlo, kdsthi

## Performance

kin -- Input signal

ksrclo -- Lower limit of input range

ksrchi -- Higher limit of input range

kdstlo -- Lower limit of output range

kdsthi -- Higher limit of output range

    out = (in - srclo) / (srchi - srclo) * (dsthi - dstlo) + dstlo

## Examples

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

Example 462. Example of the linlin opcode.

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 128
    nchnls = 2
    0dbfs = 1.0

    ; Map a value within the range 1-3 to the range 0-10.

    instr 1
      kx line 1, p3, 3
      ky linlin kx, 1, 3, 0, 10
      printks "kx: %f   ky: %f \n", 1/kr, kx, ky
    endin

    </CsInstruments>
    <CsScore>
    i 1 0 1

    </CsScore>
    </CsoundSynthesizer>

## See Also

scale, ntrpol, bpf

## Credits

By: Eduardo Moguillansky 2017

New in version 6.09

Prev | Up | Next
lineto | Home | link_beat_force