From 5ab8abf3fcc7d0a92d844124f709ba37a1337914 Mon Sep 17 00:00:00 2001 From: Richard Sewell Date: Sun, 16 Aug 2015 13:58:14 +0000 Subject: [PATCH] release variation --- world-o-techno.rb | 57 ++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/world-o-techno.rb b/world-o-techno.rb index 23b345f..911c871 100755 --- a/world-o-techno.rb +++ b/world-o-techno.rb @@ -55,8 +55,8 @@ define :lat do if gps != nil && gps.latitude != nil l = gps.latitude end - #print "lat" - #print l + print "lat" + print l return l end @@ -66,25 +66,32 @@ define :lon do if gps != nil && gps.longitude != nil l = gps.longitude end - #print "lon" - #print l + print "lon" + print l return l end define :latInt do - l = lat().abs * 10**9 - #print "latInt" - #print l +# Convert latitude to a suitable number, which will vary by about 1 for a sensible small movement +# One degree is 111325m (at the equator) +# 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 end define :lonInt do - l = lon().abs * 10**9 - #print "lonInt" - #print l + l = lon().abs * 300000 + l = l.round + print "lonInt" + print l return l end + define :speed do l = 0.0 if gps != nil && gps.speed != nil @@ -93,6 +100,13 @@ define :speed do return l 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 load_sample :bd_fat load_sample :bd_boom @@ -125,16 +139,17 @@ define :playTune do cue :foo - loopChord = chooseChord( lonInt() % 656753 ) + 4.times do |i| long = lonInt() % 100 use_random_seed long 4.times do 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 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 end end @@ -146,14 +161,15 @@ define :playTune do cue :bar use_synth :tb303 - loopChord = chooseChord( lonInt() % 10719881 ) + 8.times do |i| sample :bd_fat, amp: 5 use_random_seed latInt() % 1412041 + loopChord = chooseChord( lonInt() % 10719881 ) 4.times do gspeed = speed().modulo(1) #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 end end @@ -164,14 +180,15 @@ define :playTune do cue :baz with_fx :reverb, mix: 0.3 do |r| - loopChord = chooseChord( latInt() % 3101473 ) + 8.times do |m| sample :bd_fat, amp: 5 use_random_seed (lonInt() + latInt()) % 2256197 + loopChord = chooseChord( latInt() % 656753 ) 4.times do control r, mix: 0.3 + (0.5 * (m.to_f / 32.0)) unless m == 0 if m % 8 == 0 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 end end @@ -183,16 +200,16 @@ define :playTune do cue :quux in_thread do - loopChord = chooseChord( lonInt() % 480967 ) + 4.times do sample :bd_fat, amp: 5 slat = latInt().modulo(1) + 0.1 use_random_seed lonInt() % 9562447 - + loopChord = chooseChord( lonInt() % 656753 ) with_fx :slicer, mix: 0.75, wave: 3, phase: slat do 4.times do 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 end end