Bells




s.boot;

(
var numpartials, spectrum, amplitudes, modfreqs1, modfreqs2, decaytimes;

spectrum = [0.5,1,1.19,1.56,2,2.51,2.66,3.01,4.1];

amplitudes= [0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1];

numpartials = spectrum.size;

modfreqs1 = Array.rand(numpartials, 1, 5.0);  //vibrato rates from 1 to 5 Hz
// N random numbers between 1 and 5.0

modfreqs2 = Array.rand(numpartials, 0.1, 3.0);  //tremolo rates from 0.1 to 3 Hz 

decaytimes = Array.fill(numpartials,{|i|  rrand(2.5,2.5+(5*(1.0-(i/numpartials))))});  //decay from 2.5 to 7.5 seconds, lower partials longer decay

{
Mix.fill(spectrum.size, {arg i;
        var amp, freq;

        freq= (spectrum[i]+(SinOsc.kr(modfreqs1[i],0,0.005)))*500;
        amp= 0.1* Line.kr(1,0,decaytimes[i])*(SinOsc.ar(modfreqs2[i],0,0.1,0.9)* amplitudes[i]);

        Pan2.ar(SinOsc.ar(freq, 0, amp),1.0.rand2)});
        // rand2 = 2. Between -<number> and <number>
        // Pan2.ar(in, pos, level);
}.scope

)

Leave a Reply