The Alternative Csound Reference Manual
Previous |  | Next

# loscil3

loscil3 -- Read sampled sound from a table using cubic interpolation.

## Description

Read sampled sound from a table using cubic interpolation.

## Syntax

ar [,ar2] loscil3 xamp, kcps, ifn [, ibas] [, imod1] [, ibeg1] [, iend1] [, imod2] [, ibeg2] [, iend2]

## Initialization

ifn -- function table number, typically denoting an AIFF sampled sound segment with prescribed looping points. The source file may be mono or stereo.

ibas (optional) -- base frequency in Hz of the recorded sound. This optionally overrides the frequency given in the AIFF file, but is required if the file did not contain one. The default value is 261.626 Hz, i.e. middle C. (New in Csound 4.03).

imod1, imod2 (optional, default=-1) -- play modes for the sustain and release loops. A value of 1 denotes normal looping, 2 denotes forward & backward looping, 0 denotes no looping. The default value (-1) will defer to the mode and the looping points given in the source file.

ibeg1, iend1, ibeg2, iend2 (optional, dependent on mod1, mod2) -- begin and end points of the sustain and release loops. These are measured in sample frames from the beginning of the file, so will look the same whether the sound segment is monaural or stereo.

## Performance

ar1, ar2 -- the output at audio-rate. There is just ar1 for mono output. However, there is both ar1 and ar2 for stereo output.

xamp -- the amplitude of the output signal.

kcps -- the frequency of the output signal in cycles per second.

loscil3 is experimental. It is identical to loscil except that it uses cubic interpolation. New in Csound version 3.50.

| Note
| This is mono loscil3:
    a1 loscil3 10000, 1, 1
...and this is stereo loscil3:
    a1, a2 loscil3 10000, 1, 1

## Examples

Here is an example of the loscil3 opcode. It uses the files loscil3.orc, loscil3.sco, and beats.aiff.

Example 1. Example of the loscil3 opcode.

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

    ; Instrument #1.
    instr 1
       kamp = 30000
       ; If you don't know the frequency of your audio file,
       ; set both the kcps and ibas parameters equal to 1.
       kcps = 1
       ifn = 1
       ibas = 1

       a1 loscil3 kamp, kcps, ifn, ibas
       out a1
    endin
    /* loscil3.orc */

    /* loscil3.sco */
    ; Table #1: an audio file.
    f 1 0 131072 1 "beats.aiff" 0 4 0

    ; Play Instrument #1 for 6 seconds.
    ; This will loop the drum pattern several times.
    i 1 0 6
    e
    /* loscil3.sco */

## See Also

loscil

## Credits

Note about the mono/stereo difference was contributed by Rasmus Ekman.

Example written by Kevin Conder.

Previous | Home | Next
loscil | Up | lowpass2