SuperCollider CLASSES (extension)

FMGrainI
ExtensionExtension

Granular synthesis with FM grains and user supplied envelopes
Inherits from: JoshGrain : UGen : AbstractFunction : Object

Description

Class Methods

*ar (trigger: 0, dur: 1, carfreq: 440, modfreq: 200, index: 1, envbuf1, envbuf2, ifac: 0.5, mul: 1, add: 0)

Arguments:

trigger

A kr or ar trigger to start a new grain. If ar, grains after the start of the synth are sample accurate. The following args are polled at grain creation time.

dur

Size of the grain.

carfreq

The carrier freq of the grain generators internal oscillator.

modfreq

The modulating freq of the grain generators internal oscillator.

index

The index of modulation.

envbuf1

A buffer with a stored signal to be used for the envelope of the grain.

envbuf2

A buffer with a stored signal to be used for the envelope of the grain.

ifac

An interpolation factor. interpolates between the two envelopes where 0 is all envbuf1, and 1 is all envbuf2.

mul
add

Inherited class methods

Instance Methods

Inherited instance methods

Examples

s.boot;

(
SynthDef(\fm_grain_test, {arg gate = 1, amp = 1, envbuf1, envbuf2;
    Out.ar(0,
        FMGrainI.ar(Impulse.kr(10), 0.2, WhiteNoise.kr.range(440, 880), 200,
            LFNoise1.kr(1).range(1, 10), envbuf1, envbuf2, MouseX.kr(0, 1),
            EnvGen.kr(
                Env([0, 1, 0], [1, 1], \sin, 1),
                gate,
                levelScale: amp,
                doneAction: 2)
        )
    )
}).add;
)

y = Env([0, 1, 0], [1, 1], \sin).asSignal(1024);
z = Env([0, 1, 0], [1, 1], [10, -10]).asSignal(1024);
s.sendMsg(\b_alloc, b = s.bufferAllocator.alloc(1), 1024, 1, [\b_setn, b, 0, 1024] ++ y)
s.sendMsg(\b_alloc, c = s.bufferAllocator.alloc(1), 1024, 1, [\b_setn, c, 0, 1024] ++ z)
s.sendMsg(\s_new, \fm_grain_test, a=s.nextNodeID, 0, 1, \amp, 0.2, \envbuf1, b, \envbuf2, c);
s.sendMsg(\n_set, a, \gate, 0);
s.sendMsg(\b_free, b);
s.sendMsg(\b_free, c);