xxxxxxxxxx
111
// check the editor >>> https://sfxr.me/
let alive = 0;
let xoff = 0;
let yoff = 0;
function setup() {
createCanvas(200, 200);
}
function draw() {
background(220);
if(alive>.1){
alive *= .96;
xoff = sin( millis() *.1 ) * alive * 30;
yoff = sin( millis() *.3 ) * alive * 30;
}
let px = width/2 + xoff;
let py = height/2 + yoff;
fill(0);
noStroke();
ellipse(px,py,111,111);
}
let attack = 0; // anstieg
let sustain = 0; // halten
let decay = 0; // abfall
function mousePressed(){
alive = 1;
sound['wave_type']= int(random()*2)+1;
sound['p_base_freq']= random()*.4+.2;
sound['p_freq_ramp']= random()*.8+.1;
sound['p_vib_strength']= random()*.7;
sound['p_vib_speed']= random()*1.1;
sound['p_repeat_speed']= random()*.9+.1;
sound['p_env_attack']= random()*.3+.03;
sound['p_env_sustain']= random()*.3+.1;
sound['p_env_decay']= random()*.1+.4;
sound['p_env_punch']= random()*.8+.1;
sound['p_arp_speed']= random()*.4+1.1;
sound['p_arp_mod']= random()*.4+.5;
var s = new SoundEffect(sound).generate();
// returns a webaudio object if supported, or an Audio object
s.getAudio().play();
}
var sound = {
"oldParams": true,
"wave_type": 1,
"p_env_attack": 0,
"p_env_sustain": 0.31718502829007483,
"p_env_punch": 0,
"p_env_decay": 0.2718540993592685,
"p_base_freq": 0.26126191208337196,
"p_freq_limit": 0,
"p_freq_ramp": 0.43787689856926615,
"p_freq_dramp": 0,
"p_vib_strength": 0,
"p_vib_speed": 0,
"p_arp_mod": 0,
"p_arp_speed": 0,
"p_duty": 1,
"p_duty_ramp": 0,
"p_repeat_speed": 0.7558565452384385,
"p_pha_offset": 0,
"p_pha_ramp": 0,
"p_lpf_freq": 1,
"p_lpf_ramp": 0,
"p_lpf_resonance": 0,
"p_hpf_freq": 0,
"p_hpf_ramp": 0,
"sound_vol": 0.25,
"sample_rate": 44100,
"sample_size": 8
};