Additive Synthesis - SuperCollider





















Sin

(
var sig, amp = 0.75, freq = 440 ;
sig = Signal.sineFill(100, [1]).scale(amp) ;
sig.plot(minval:-1, maxval:1) ;
)


Saw

(
var sig, arr ;
arr = Array.series(size: 1000, start: 1, step: 1) ; 
sig = Signal.sineFill(1024, 1.0/arr) ;
sig.plot(minval:-1, maxval:1) ;
)


Square

(
var sig, arr, arr1, arr2 ;
arr1 = Array.series(size: 500, start: 1, step: 2) ;
arr1 = 1.0/arr1 ;
arr2 = Array.fill(500, {0}) ;
arr = [arr1, arr2].flop.flat ;
// arr = [arr1, arr2].lace(1000) ;
sig = Signal.sineFill(1024, arr) ;
sig.plot ;
)


Tri

(
var first, second, third, fourth, total ;
var size = 50 , step;
step = 1.0/size ;
first = Signal.series(size, 0, step) ;
second = (first+step).reverse ;
third = second-1 ;
fourth = first-1 ;
total = (first++second++third++fourth) ;
total.plot;

)

Tri

(
var sig, arr, arr1, arr2 , i;
j=0;
arr1=Array.newClear(1000);

for (0, 1999, { arg i;
if (i.odd) {
if (j.odd) {arr1[j]=1/(i*i);};
if (j.even){arr1[j]=(1/(i*i))*(-1)};
j=j+1;
};
});

arr2 = Array.fill(1000, {0}) ;
arr = [arr1, arr2].flop.flat ;
arr.postln;
sig = Signal.sineFill(2000, arr) ;
sig.plot ;

)


Leave a Reply