release variation

This commit is contained in:
Richard Sewell 2015-08-16 13:58:14 +00:00
parent 18abe36137
commit 5ab8abf3fc
1 changed files with 37 additions and 20 deletions

View File

@ -55,8 +55,8 @@ define :lat do
if gps != nil && gps.latitude != nil if gps != nil && gps.latitude != nil
l = gps.latitude l = gps.latitude
end end
#print "lat" print "lat"
#print l print l
return l return l
end end
@ -66,25 +66,32 @@ define :lon do
if gps != nil && gps.longitude != nil if gps != nil && gps.longitude != nil
l = gps.longitude l = gps.longitude
end end
#print "lon" print "lon"
#print l print l
return l return l
end end
define :latInt do define :latInt do
l = lat().abs * 10**9 # Convert latitude to a suitable number, which will vary by about 1 for a sensible small movement
#print "latInt" # One degree is 111325m (at the equator)
#print l # We'd like to see about a foot, 0.3m, so we'll want a factor of 300000
# Our GPS report better resolution than that, about 10**-9 degree, but that's not very repeatable
l = lat().abs * 300000
l = l.round
print "latInt"
print l
return l return l
end end
define :lonInt do define :lonInt do
l = lon().abs * 10**9 l = lon().abs * 300000
#print "lonInt" l = l.round
#print l print "lonInt"
print l
return l return l
end end
define :speed do define :speed do
l = 0.0 l = 0.0
if gps != nil && gps.speed != nil if gps != nil && gps.speed != nil
@ -93,6 +100,13 @@ define :speed do
return l return l
end end
define :locationRelease do |r|
# Scale our parameter up or down by a factor of 2 depending on location
factor = (latInt() + lonInt()) % 30 # varies from 0 to 30 over distance of 10m
factor = (factor / 30) + 0.5 # varies from 0.5 to 1.5 over 10m
return r * factor
end
sleep 2 sleep 2
load_sample :bd_fat load_sample :bd_fat
load_sample :bd_boom load_sample :bd_boom
@ -125,16 +139,17 @@ define :playTune do
cue :foo cue :foo
loopChord = chooseChord( lonInt() % 656753 )
4.times do |i| 4.times do |i|
long = lonInt() % 100 long = lonInt() % 100
use_random_seed long use_random_seed long
4.times do 4.times do
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
use_random_seed lonInt() % 257867 # Use a selection of large primes to get different seeds for each loop loopChord = chooseChord( lonInt() % 656753 ) # Pick chord form position on each bar so we hear motion sooner
use_random_seed lonInt() % 257867 # Use a selection of large primes to get different seeds hence different tunes for each loop
4.times do 4.times do
use_synth :tb303 use_synth :tb303
play chord(loopChord, :minor).choose, attack: 0, release: 0.1, cutoff: rrand_i(50, 90) + i * 10 play chord(loopChord, :minor).choose, attack: 0, release: locationRelease(0.1), cutoff: rrand_i(50, 90) + i * 10
sleep 0.125 sleep 0.125
end end
end end
@ -146,14 +161,15 @@ define :playTune do
cue :bar cue :bar
use_synth :tb303 use_synth :tb303
loopChord = chooseChord( lonInt() % 10719881 )
8.times do |i| 8.times do |i|
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
use_random_seed latInt() % 1412041 use_random_seed latInt() % 1412041
loopChord = chooseChord( lonInt() % 10719881 )
4.times do 4.times do
gspeed = speed().modulo(1) gspeed = speed().modulo(1)
#puts gspeed #puts gspeed
play chord(loopChord, :minor).choose, attack: 0, release: 0.05, cutoff: rrand_i(70, 98) + i, res: gspeed play chord(loopChord, :minor).choose, attack: 0, release: locationRelease(0.05), cutoff: rrand_i(70, 98) + i, res: gspeed
sleep 0.125 sleep 0.125
end end
end end
@ -164,14 +180,15 @@ define :playTune do
cue :baz cue :baz
with_fx :reverb, mix: 0.3 do |r| with_fx :reverb, mix: 0.3 do |r|
loopChord = chooseChord( latInt() % 3101473 )
8.times do |m| 8.times do |m|
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
use_random_seed (lonInt() + latInt()) % 2256197 use_random_seed (lonInt() + latInt()) % 2256197
loopChord = chooseChord( latInt() % 656753 )
4.times do 4.times do
control r, mix: 0.3 + (0.5 * (m.to_f / 32.0)) unless m == 0 if m % 8 == 0 control r, mix: 0.3 + (0.5 * (m.to_f / 32.0)) unless m == 0 if m % 8 == 0
use_synth :prophet use_synth :prophet
play chord(loopChord, :minor).choose, attack: 0, release: 0.08, cutoff: rrand_i(110, 130) play chord(loopChord, :minor).choose, attack: 0, release: locationRelease(0.08), cutoff: rrand_i(110, 130)
sleep 0.125 sleep 0.125
end end
end end
@ -183,16 +200,16 @@ define :playTune do
cue :quux cue :quux
in_thread do in_thread do
loopChord = chooseChord( lonInt() % 480967 )
4.times do 4.times do
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
slat = latInt().modulo(1) + 0.1 slat = latInt().modulo(1) + 0.1
use_random_seed lonInt() % 9562447 use_random_seed lonInt() % 9562447
loopChord = chooseChord( lonInt() % 656753 )
with_fx :slicer, mix: 0.75, wave: 3, phase: slat do with_fx :slicer, mix: 0.75, wave: 3, phase: slat do
4.times do 4.times do
use_synth :tb303 use_synth :tb303
play chord(loopChord, :major).choose, attack: 0, release: 0.1, cutoff: rrand(50, 100) play chord(loopChord, :major).choose, attack: 0, release: locationRelease(0.1), cutoff: rrand(50, 100)
sleep 0.25 sleep 0.25
end end
end end