Previous topic

SuperCollider Examples

Next topic

Vectorize

This Page

Resonator

SuperCollider

(
{
Mix(
        Resonz.ar(
                Saw.ar( [440,443,437] + SinOsc.ar(100,0,100) ),
                XLine.kr(10000,10,10),
                Line.kr(1,0.05, 10),
                LFSaw.kr(Line.kr(3,17,3),0,0.5,0.5)*Line.kr(1,0,10)
        )
)
}.play
)

Stride

signal SineWave         { rate: AudioRate }
signal SawWaves [3]     { rate: AudioRate }
signal SawWave          { rate: ControlRate }
signal CenterFrequency  { rate: ControlRate }
signal Bandwidth        { rate: ControlRate }
signal Amplitude        { rate: ControlRate }
signal AM_Frequency     { rate: ControlRate }

Curve (
        startValue:     [ 10000. , 1. , 1. , 3. ]
        stopValue:      [ 10. , 0.05 , 0. , 17. ]
        duration:       [ 10, 10., 10., 3.]
        mode:           [ 'Exponential', 'Linear', 'Linear', 'Linear' ]
        reset:          none
)
>> [ CenterFrequency, Bandwidth, Amplitude, AM_Frequency ];

Oscillator (
        type:           [ 'Sine', 'Saw', 'Saw', 'Saw', 'Saw' ]
        frequency:      [ 100., [ 440., 443., 437.] + SineWave, AM_Frequency ]
        amplitude:      [ 100., 1., 1., 1., 0.5 ]
)
>> [ SineWave, SawWaves, AM_SawWave ];

SawWaves
>> Mix ()
>> Filter (
        centerFrequency:        CenterFrequency
        qFactor:                Bandwidth
)
>> Level (
        gain:   ( AM_SawWave + 0.5 ) * Amplitude
)
>> AudioOut[1:2];
module Curve {
        input:                  none
        output:                 Output
        propertyName:           [ 'startValue', 'stopValue', 'duration', 'mode', 'reset' ]
        propertyDirection:      in
        propertyBlock:          [
                constant StartValue { value: 0.0 },
                constant StopValue { value: 1.0 },
                constant Duration { value: 1.0 },
                constant Mode { value: 'Linear' },
                trigger Reset {}
        ]
        internalBlock:          [
                signal Output { rate: none }
                signal Count { rate: streamRate reset: Reset}
                trigger Done {}
        ]
        streams:                        [
                Counter (
                        startValue:     0
                        rollValue:      1
                        increment:      1 / (streamRate * Duration)
                        stop:           Done
                        reset:          Reset
                )
                >> Count
                >> OnChange()
                >> Map (
                        mode:           Mode
                        minimum:        StartValue
                        maximum:        StopValue
                )
                >> Output;

                Count >> Compare ( value: 1 operator: 'Equal' ) >> Done;
        ]
}