adsyn
Prev | Orchestra Opcodes and Operators | Next

## adsyn

adsyn — Output is an additive set of individually controlled sinusoids, using an oscillator bank.

## Description

Output is an additive set of individually controlled sinusoids, using an oscillator bank.

## Syntax

    ares adsyn kamod, kfmod, ksmod, ifilcod

## Initialization

ifilcod -- integer or character-string denoting a control-file derived from analysis of an audio signal. An integer denotes the suffix of a file adsyn.m or pvoc.m; a character-string (in double quotes) gives a filename, optionally a full pathname. If not fullpath, the file is sought first in the current directory, then in the one given by the environment variable SADIR (if defined). adsyn control contains breakpoint amplitude- and frequency-envelope values organized for oscillator resynthesis, while pvoc control contains similar data organized for fft resynthesis. Memory usage depends on the size of the files involved, which are read and held entirely in memory during computation but are shared by multiple calls (see also lpread).

## Performance

kamod -- amplitude factor of the contributing partials.

kfmod -- frequency factor of the contributing partials. It is a control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and .5 down an octave.

ksmod -- speed factor of the contributing partials.

adsyn synthesizes complex time-varying timbres through the method of additive synthesis. Any number of sinusoids, each individually controlled in frequency and amplitude, can be summed by high-speed arithmetic to produce a high-fidelity result.

Component sinusoids are described by a control file describing amplitude and frequency tracks in millisecond breakpoint fashion. Tracks are defined by sequences of 16-bit binary integers:

-1, time, amp, time, amp,...
-2, time, freq, time, freq,...

such as from hetrodyne filter analysis of an audio file. (For details see hetro.) The instantaneous amplitude and frequency values are used by an internal fixed-point oscillator that adds each active partial into an accumulated output signal. While there is a practical limit (limit removed in version 3.47) on the number of contributing partials, there is no restriction on their behavior over time. Any sound that can be described in terms of the behavior of sinusoids can be synthesized by adsyn alone.

Sound described by an adsyn control file can also be modified during re-synthesis. The signals kamod, kfmod, ksmod will modify the amplitude, frequency, and speed of contributing partials. These are multiplying factors, with kfmod modifying the frequency and ksmod modifying the speed with which the millisecond breakpoint line-segments are traversed. Thus .7, 1.5, and 2 will give rise to a softer sound, a perfect fifth higher, but only half as long. The values 1,1,1 will leave the sound unmodified. Each of these inputs can be a control signal.

## Examples

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

Example 49. Example of the adsyn 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
    -odac     ;;;RT audio out
    ;-iadc    ;;;uncomment -iadc if RT audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o adsyn.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    ; by Menno Knevel - 2021

    ires system_i 1,{{ hetro -f100 -h100 stereoJungle.wav Jungle.het }} ; start at 100 Hz, harmonics up to 10kHz

    instr 1         ; play original sample
    aL,aR    diskin  "stereoJungle.wav", 1
            outs    aL, aR
    endin

    instr 2
    kamod = 3       ; scale amplitude
    kfmod = p4
    ksmod = p5
    asig	adsyn	kamod, kfmod, ksmod, "Jungle.het"
            outs	asig, asig
    endin

    </CsInstruments>
    <CsScore>
    s
    i1 0 7                  ; original sample
    s
    ;           frqmod speed
    i2 0  20      1    .2   ; 5 x slower
    i2 20 5       2     1   ; 2 x higher
    i2 25 15     .3    1.5  ; lower & faster
    e
    </CsScore>
    </CsoundSynthesizer>

## See also

Additive Synthesis/Resynthesis

Prev | Up | Next
adsr | Home | adsynt