p= ProxySpace.push(s.boot)
p.makeTempoClock(1.5)
c= p.clock

//trying to code a soft bubbling soundscape
~out.ar(2)
p.fadeTime_(5)

~wind= {RLPF.ar(WhiteNoise.ar(LFNoise2.kr(0.2, 0.06, 0.06)))}
~out= ~wind
~out.play

~waves= {RLPF.ar(WhiteNoise.ar(SinOsc.kr(LFNoise1.kr(0.2, 0.05, 0.1), 0, 0.1).abs))}
~out= ~wind+~waves

~waves= {RLPF.ar(WhiteNoise.ar(SinOsc.kr(LFNoise1.kr(0.2, 0.05, 0.1), 0, 0.1).abs), 1000, 0.6)}
~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.2), 0.4, 2)))}
~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.1, 0, LFNoise1.kr(0.2, 0.1, 0.5), 0.2, 0.05), 1, 3)), LFNoise2.kr(0.1, 100, 1000), LFNoise2.kr(0.1, 0.1, 0.6))}

~wind= {Pan2.ar(RLPF.ar(WhiteNoise.ar(LFNoise2.kr(0.2, 0.06, 0.06)), LFNoise2.kr(0.1, 50, 400), LFNoise2.kr(0.1, 0.05, 0.15)), LFNoise2.kr(0.1, 0.9))}

~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(200, 100, 300), 0, SinOsc.ar(LFNoise2.kr(0.2, 10, 20), 0, 0.5).abs), LFNoise1.kr(0.9))}
~out= ~wind+~waves+~bubble

~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(200, 1000).abs, 0, SinOsc.ar(LFNoise2.kr(0.2, 10, 20), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}

~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(LFNoise2.kr(0.2, 40, 80), 1000).abs, 0, SinOsc.ar(LFNoise2.kr(0.2, 10, 20), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}

~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.1, 0, LFNoise1.kr(0.2, 0.1, 0.5), 0.2, 0.05), 1, 3)), LFNoise2.kr(0.1, 100, 800), LFNoise2.kr(0.1, 0.1, 0.9))}

~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(LFNoise2.kr(0.2, 40, 80), LFNoise2.kr(0.2, 200, 500)).abs, 0, SinOsc.ar(LFNoise2.kr(0.2, 10, 20), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}

~bubble2= {Pan2.ar(SinOsc.ar((~bubble.ar*300).abs, 0, 0.1))}
~out= ~wind+~waves+~bubble+~bubble2

~bubble2= {Pan2.ar(SinOsc.ar((~bubble.ar*400).abs, 0, 0.2))}
~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(SinOsc.kr(0.6, 0, 40, 80), SinOsc.kr(0.6, 0, 200, 500)).abs, 0, SinOsc.ar(SinOsc.kr(0.6, 0, 10, 20), 0, 0.5).abs), SinOsc.kr(0.3, 0, 0.5))}

~bubble2= {Pan2.ar(SinOsc.ar((~bubble.ar*600).abs, 0, 0.2), -0.3)}
~bubble3= {Pan2.ar(SinOsc.ar((~bubble2.ar*300).abs, 0, 0.2), 0.3)}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3

~bubble4= {Pan2.ar(SinOsc.ar(~bubble3.ar*100+1000), 0, ~bubble2.ar.abs*0.1)}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3+~bubble4

~bubble4= {Pan2.ar(SinOsc.ar(~bubble3.ar*300+1000), 0, ~bubble2.ar.abs*0.1)}

~bubble5= {Pan2.ar(SinOsc.ar(~waves.ar*500+2000), 0, ~bubble2.ar.abs*0.1)}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3+~bubble4+~bubble5

~bubble6= {Pan2.ar(SinOsc.ar(~wind.ar*500+5000, 0, ~bubble2.ar.abs*0.05), 0.1)}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3+~bubble4+~bubble5+~bubble6

~bubble6= {Pan2.ar(SinOsc.ar(~wind.ar*1000+5000, 0, ~bubble3.ar.abs*0.05), 0.1)}

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6, 0, 20, 50).round(40)))}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3+~bubble4+~bubble5+~bubble6+~bass

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6, 0, 20, 60).round(40)), SinOsc.kr(0.3, 0, 100, 200))}
~crack= {Crackle.ar(1.98, SinOsc.kr(0.3, 0, 0.2, 0.2))}
~out= ~wind+~waves+~bubble+~bubble2+~bubble3+~bubble4+~bubble5+~bubble6+~bass+~crack

~crack= {RHPF.ar(Crackle.ar(1.98, SinOsc.kr(0.3, 0, 0.2, 0.2)), 1000, 0.05, 0.5)}

~bubble3= {Pan2.ar(SinOsc.ar((~bubble2.ar*500).abs, 0, 0.3), 0.3)}
~bubble4= {Pan2.ar(SinOsc.ar(~bubble3.ar*200+1000), 0, ~bubble2.ar.abs*0.08)}
~bubble5= {Pan2.ar(SinOsc.ar(~waves.ar*300+2000), 0, ~bubble2.ar.abs*0.08)}
~bubble6= {Pan2.ar(SinOsc.ar(~wind.ar*2000+SinOsc.kr(0.15, 0, 1500, 6000).round(1000), 0, ~bubble2.ar.abs*0.03), 0.1)}

~wind= {Pan2.ar(RLPF.ar(WhiteNoise.ar(SinOsc.kr(0.3, 0, 0.06, 0.06)), SinOsc.kr(0.15, 0, 50, 400), SinOsc.kr(0.15, 0, 0.05, 0.15)), SinOsc.kr(0.15, 0, 0.9))}

~crack= {RHPF.ar(Crackle.ar(SinOsc.kr(0.3, 0, 0.05, 1.9), SinOsc.kr(0.3, 0, 0.2, 0.2)), 1000, 0.07, 0.5)}

~bubble6= {Pan2.ar(SinOsc.ar(~wind.ar*3000+SinOsc.kr(0.15, 0, 1500, 6000).round(1000), 0, ~bubble2.ar.abs*0.01), 0.1)}

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6, 0, 20, 70).round(40)), SinOsc.kr(0.3, 0, 100, 500))}
~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 30, 70).round(40)), SinOsc.kr(0.6, 0, 100, 500))}

~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.1, 0, SinOsc.kr(0.3, 0, 0.1, 0.5), 0.2, 0.05), 0.5, 3)), SinOsc.kr(0.6, 0, 100, 1000), SinOsc.kr(0.6, 0, 0.1, 0.6))}

~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.1, 0, SinOsc.kr(0.3, 0, 0.1, 0.5), 0.2, 0.05), 0.1, 3)), SinOsc.kr(0.6, 0, 100, 1000), SinOsc.kr(0.6, 0, 0.1, 0.6))}

~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.1, 0, SinOsc.kr(0.3, 0, 0.1, 0.5), 0.2, 0.05), 0.05, 4)), SinOsc.kr(0.6, 0, 200, 1000), SinOsc.kr(0.6, 0, 0.1, 0.8))}

~bubble5= {Pan2.ar(SinOsc.ar(~waves.ar*300+3000), 0, ~bubble2.ar.abs*0.08)}
~bubble5= {Pan2.ar(SinOsc.ar(~waves.ar*300+2000), 0, ~bubble2.ar.abs*0.08)}
~bubble5= {Pan2.ar(SinOsc.ar(~waves.ar*300+SinOsc.kr(0.3, 0, 1000, 2300).round(1000)), 0, ~bubble2.ar.abs*0.05)}

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 30, 70).round(50)), SinOsc.kr(0.6, 0, 100, 500))}
~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 30, 70).round(40)), SinOsc.kr(0.6, 0, 100, 500))}
~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 30, 70).round(SinOsc.kr(0.15, 0, 8, 45).round(10))), SinOsc.kr(0.6, 0, 100, 500))}

~crack= {RHPF.ar(Crackle.ar(SinOsc.kr(0.3, 0, 0.05, 1.9), SinOsc.kr(0.3, 0, 0.2, 0.2)), SinOsc.kr(0.15, 0, 300, 1000), 0.05, 0.5)}

~bubble3= {Pan2.ar(SinOsc.ar((~bubble2.ar*700).abs, 0, 0.3), 0.3)}

~bubble3= {Pan2.ar(SinOsc.ar((~bubble2.ar*SinOsc.kr(0.15, 0, 100, 600).round(50)).abs, 0, 0.3), 0.3)}

~bubble4= {Pan2.ar(SinOsc.ar(~bubble3.ar*300+1000), 0, ~bubble2.ar.abs*0.08)}

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 35, 70).round(SinOsc.kr(0.15, 0, 10, 45).round(10))), SinOsc.kr(0.6, 0, 100, 600))}

~crack.release(30)

~bubble3= {Pan2.ar(SinOsc.ar((~bubble2.ar*SinOsc.kr(0.3, 0, 100, 600).round(100)).abs, 0, 0.3), 0.3)}

~bass= {LPF.ar(Saw.ar(SinOsc.kr(0.6+0.15, 0, 15, 70).round(SinOsc.kr(0.15, 0, 10, 45).round(10))), SinOsc.kr(0.6, 0, 50, 400))}
~bass.release(30)

~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.15, 0, SinOsc.kr(0.15, 0, 0.1, 0.5), 0.2, 0.05), 0.2, 2)), SinOsc.kr(0.6, 0, 100, 1000), SinOsc.kr(0.6, 0, 0.1, 0.6))}
~wind= {Pan2.ar(RLPF.ar(WhiteNoise.ar(SinOsc.kr(0.15, 0, 0.03, 0.03)), SinOsc.kr(0.15, 0, 50, 400), SinOsc.kr(0.15, 0, 0.03, 0.1)), SinOsc.kr(0.15, 0, 0.9))}

~bubble5.release(10)
~bubble6.release(20)

~bubble2= {Pan2.ar(SinOsc.ar((~bubble.ar*200).abs, 0, 0.2), -0.3)}
~bubble2= {Pan2.ar(SinOsc.ar((~bubble.ar*100).abs, 0, 0.1), -0.3)}
~bubble4.release(30)

~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(LFNoise2.kr(0.2, 30, 60), LFNoise2.kr(0.2, 100, 400)).abs, 0, SinOsc.ar(LFNoise2.kr(0.2, 5, 10), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}
~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(SinOsc.kr(0.3, 0, 30, 60), SinOsc.kr(0.3, 0, 100, 400)).abs, 0, SinOsc.ar(SinOsc.kr(0.15, 0, 5, 10), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}
~bubble= {Pan2.ar(SinOsc.ar(LFNoise2.ar(SinOsc.kr(0.3, 0, 30, 60), SinOsc.kr(0.3, 0, 50, 200)).abs, 0, SinOsc.ar(SinOsc.kr(0.15, 0, 5, 10), 0, 0.5).abs), LFNoise1.kr(0.1, 0.9))}
~waves= {RLPF.ar(WhiteNoise.ar(Amplitude.kr(LFPulse.kr(0.15/2, 0, SinOsc.kr(0.15, 0, 0.1, 0.5), 0.2, 0.05), 3.2, 2)), SinOsc.kr(0.6, 0, 100, 1000), SinOsc.kr(0.6, 0, 0.1, 0.6))}
~wind= {Pan2.ar(RLPF.ar(WhiteNoise.ar(SinOsc.kr(0.15/2, 0, 0.03, 0.03)), SinOsc.kr(0.15/2, 0, 50, 400), SinOsc.kr(0.15/2, 0, 0.03, 0.1)), 0)}
~wind.release(40)
~bubble.release(40)
~crack.rebuild
~crack= {RHPF.ar(Crackle.ar(SinOsc.kr(0.3, 0, 0.05, 1.9), SinOsc.kr(0.15, 0, 0.1, 0.1)), SinOsc.kr(0.15, 0, 150, 1000), 0.05, 0.5)}
~bubble2.isPlaying
~bubble2.release(20)
~crack.release(20)

~waves.release(40)

p.clear
p.pop