scans
Prev | Orchestra Opcodes and Operators | Next

## scans

scans — Generate audio output using scanned synthesis.

## Description

Plugin opcode in scansyn.

Generate audio output using scanned synthesis.

## Syntax

    ares scans kamp, kfreq, ifn, id [, iorder]

## Initialization

ifn -- ftable containing the scanning trajectory. This is a series of numbers that contains addresses of masses. The order of these addresses is used as the scan path. It should not contain values greater than the number of masses, or negative numbers. See the introduction to the scanned synthesis section.

id -- ID number of the scanu opcode's waveform to use

iorder (optional, default=0) -- order of interpolation used internally. It can take any value in the range 1 to 4, and defaults to 4 if outside that range, which is quartic interpolation. The setting of 3 is cubic, 2 is quadratic and 1 is linear. The higher numbers are slower, but not necessarily better.

## Performance

kamp -- output amplitude. Note that the resulting amplitude is also dependent on instantaneous value in the wavetable. This number is effectively the scaling factor of the wavetable.

kfreq -- frequency of the scan rate

## Examples

Here is an example of the scanned synthesis. It uses the file scans.csd, and string-128.matrix.

Example 867. Example of the scans opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o scans.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

        sr =   44100
        ksmps =   128
        nchnls =   1

        instr 1
    a0  = 0
    ;   scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
        scanu 1,     .01,    6,       2,       3,     4,        5,       2,     .1,    .1,     -.01,  .1,    .5,     0,    0,        a0,  1,     2
    ;ar scans kamp,      kfreq,      ifntraj, id
    a1  scans ampdb(p4), cpspch(p5), 7,       2
        out a1
        endin

    </CsInstruments>
    <CsScore>

    ; Initial condition
    f1 0 128 7 0 64 1 64 0

    ; Masses
    f2 0 128 -7 1 128 1

    ; Spring matrices
    f3 0 16384 -23 "string-128.matrix"

    ; Centering force
    f4  0 128 -7 0 128 2

    ; Damping
    f5 0 128 -7 1 128 1

    ; Initial velocity
    f6 0 128 -7 0 128 0

    ; Trajectories
    f7 0 128 -5 .001 128 128

    ; Note list
    i1 0  10  86 6.00
    i1 11 14  86 7.00
    i1 15 20  86 5.00
    e

    </CsScore>
    </CsoundSynthesizer>

Here is another example of the scanned synthesis, using samples as excitation signal. It uses the file scans-2.csd.

Example 868. Second example of the scans opcode.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac   ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o scans-2.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    strset 1, "mary.wav"
    strset 2, "fox.wav"

    instr 	2	;show 2 different trajectories, with samples as excitation signal

    ismp = p6
    iamp = p7
    itrj = p8
    aout soundin p6				;choose wave file
         scanu ismp, .01, 6, 2, 33, 44, 5, 2, .01, .05, -.05, .1, .5, 0, 0, aout, 1, 0
    asig scans iamp, cpspch(p5), itrj , 0
         outs asig, asig

    endin
    </CsInstruments>
    <CsScore>
    f1 0 128 7 0 64 1 64 0			; Initial condition
    f2 0 128 -7 1 128 0.3			; Masses
    f33 0 16384 -23 "cylinder-128,8"	; Spring matrices
    f44 0 128 -7 2 4 0 124 2		; Centering force
    f5 0 128 -7 1 128 0			; Damping
    f6 0 128 -7 -.0 128 0			; Initial velocity
    f7 0 128 -5 .001 128 128		; Trajectories
    f77 0 128 -23 "spiral-8,16,128,2,1over2"

    s
    i2 0  5  63 6.00 1 .9 7			;"mary.wav" &
    i2 6  5  60 7.00			;trajectory table 7
    i2 10 5  60 8.00

    s
    i2 0  5  63 6.00 2 .08 7		;"fox.wav", at much lower volume
    i2 6  5  60 7.00
    i2 10 5  60 8.00

    s
    i2 0  5  63 6.00 1 .9 77		;"mary.wav" &
    i2 6  5  60 7.00			;trajectory table 77
    i2 10 5  60 8.00

    s
    i2 0  5  63 6.00 2 .08 77		;"fox.wav", at much lower volume
    i2 6  5  60 7.00
    i2 10 5  60 8.00
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

The matrix file “string-128.matrix”, as well as several other matrices, is also available in a zipped file from the Scanned Synthesis page at cSounds.com.

More information on this opcode: http://www.csounds.com/stevenyi/scanned/yi_scannedSynthesis.html , written by Steven Yi

## Credits

Author: Paris Smaragdis
MIT Media Lab
Boston, Massachussetts USA

New in Csound version 4.05

Prev | Up | Next
scanhammer | Home | scantable