# A Rainy Night in Bristol

**URL:** <https://in-thread.sonic-pi.net/t/a-rainy-night-in-bristol/659>\
**Category:** Performances, Streams & Live Coding\
**Created:** [January 27, 2018, 12:50am UTC](https://in-thread.sonic-pi.net/t/a-rainy-night-in-bristol/659 "2018-01-27T00:50:40Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Eli](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/eli/32/116_2.png) [@Eli](https://in-thread.sonic-pi.net/u/Eli)\
**Post date:** [January 28, 2018, 5:42pm UTC](https://in-thread.sonic-pi.net/t/a-rainy-night-in-bristol/659/7 "2018-01-28T17:42:52Z")

</div>

I usually only post simple tracks… in actual fact you can track just about  
anything…

tracker = [0,0,0]  
loop\_volume = [0,0,0]  
note\_duration = [0,0,0]

and make defines to set volumes, etc…

#Reduce any particular sound loop’s volume  
define :reduce do |i, n |  
if loop\_volume[i] - n \> 0 then  
loop\_volume[i] = loop\_volume[i] - n  
end  
end

#Increase any particular sound loop’s volume  
define :increase do |i, n |  
if loop\_volume[i] + n \< 10 then  
loop\_volume[i] = loop\_volume[i] + n  
else  
end  
end

In the loop you’d have something like:

if tracker[7] \> 0 then  
play 63, amp: loop\_volume[7]  
else  
sleep 0.1  
end

So a ‘script’ might be something like…

start\_loop 7  
increase 7,5 # increase loop 7 volume by 5  
sleep 8  
reduce 7, 3  
sleep 8  
stop\_loop 7

---

_[View the full topic](https://in-thread.sonic-pi.net/t/a-rainy-night-in-bristol/659)._
