Alert Condition : Red - Supercollider





esempio preso da Designing Sound Supercollider

(
Ndef(\alarm, {
        var freq, out, operations;
        freq = Duty.kr(0.05, 0, Dseq([723, 932, 1012], inf));
        freq = LPF.kr(freq, 70);
        out = SinOsc.ar(freq);
        operations = [out, (out * pi).sin, (out * pi).cos, ((out+0.25) * pi).cos];
        out = Select.ar(MouseX.kr(0,4).poll, operations);
        Pan2.ar(out * 0.1)
}).play
)


(
SynthDef(\dsaf_multialarm, {
        |length=0.05, freqs=#[600,800,600,800], timbre=1, repeats=inf|
        var freq, out, operations;
        freq = Duty.ar(length, 0, Dseq(freqs, repeats), doneAction: 2);
        freq = LPF.ar(freq, 70);
        out = LeakDC.ar(SinOsc.ar(freq));
        out = Select.ar(timbre, [out, (out * pi).sin, (out * pi).cos, ((out+0.25) * pi).cos]);
        // NOTE: when writing a synthdef always remember the Out ugen!
        // (Handy shortcuts like Ndef and {}.play often add Out on your behalf)
        DutyOut.ar(0, Pan2.ar(out * 0.1))
}).store;
)


Synth(\dsaf_multialarm, [\length, 0.01, \freqs, [1000, 0, 1000, 0], \timbre, 3, \repeats, 3000]);



Duty                demand results from demand rate ugens

Inherits from: Object : AbstractFunction : UGen

Duty.ar(dur, reset, level, doneAction)
Duty.kr(dur, reset, level, doneAction)

See also: TDuty, Demand

A value is demanded each ugen in the list and output according to a stream of duration values.
The unit generators in the list should be 'demand' rate.
     
When there is a trigger at the reset input, the demand rate ugens in the list and the duration are reset.
The reset input may also be a demand ugen, providing a stream of reset times.


LeakDC      remove DC offset

Inherits from: Object : AbstractFunction : UGen : Filter


LeakDC.ar(in, coef, mul, add)
LeakDC.kr(in, coef, mul, add)

This filter removes a DC offset from a signal.
in - input signal.
coef - leak coefficient. Defaults to 0.995 for audiorate and 0.9 for controlrate.


Select              select one output from many sources


superclass: UGen

The output is selected from an array of inputs.

    Select.ar(which, array)
    Select.kr(which, array)

Categories: Share

Leave a Reply