sensible randomisation of note sequences, original chord choices from Acid sample

This commit is contained in:
Richard Sewell 2015-08-16 11:40:56 +00:00
parent 824f51e3c9
commit a162e95a38

View file

@ -1,5 +1,17 @@
# Welcome to Sonic Pi v2.6
# world-o-techno
# Acid sample coded by Sam Aaron
# Hacked around by RS & JHR
# This file should be in /home/pi/world-o-techno so the startup script can find it
# See http://www.jarkman.co.uk/catalog/robots/worldotechno.htm and
# https://github.com/jarkman/world-o-techno for background
# GPS ruby code derived from https://github.com/ndarilek/rb-gps
#
require '/home/pi/world-o-techno/gps/gps.rb' require '/home/pi/world-o-techno/gps/gps.rb'
use_debug true use_debug false
gps = Gps::Receiver.create('gpsd',:host => 'localhost', :port => 2947) gps = Gps::Receiver.create('gpsd',:host => 'localhost', :port => 2947)
@ -10,27 +22,32 @@ define :gpsSatelliteCount do
if gps != nil && gps.satellites != nil && gps.satellites != 0 if gps != nil && gps.satellites != nil && gps.satellites != 0
s = gps.satellites.count s = gps.satellites.count
end end
print "Satellites: #{s}" puts "Satellites:"
puts s
return s; return s;
end end
define :gotFix do define :gotFix do
g = false; g = false;
print "gps in gotFix"
print gps print gps
if gps != nil if gps != nil
g = gps.latitude != nil g = gps.latitude != nil && gps.latitude != 0
end end
return g return g
end end
define :lat do define :lat do
l = 0.0 l = 0.0
if gps != nil && gps.latitude != nil if gps != nil && gps.latitude != nil
l = gps.latitude l = gps.latitude
end end
print "lat"
print l
return l return l
end end
@ -40,9 +57,24 @@ 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 l
return l return l
end end
define :latInt do
l = lat().abs * 10**9
print "latInt"
print l
return l
end
define :lonInt do
l = lon().abs * 10**9
print "lonInt"
print l
return l
end
define :speed do define :speed do
l = 0.0 l = 0.0
@ -58,9 +90,9 @@ load_sample :bd_boom
load_sample :bd_haus load_sample :bd_haus
define :playSatelliteCount do define :playSatelliteCount do
# More satellites, more thumps, so we can hear the process of acquisition
i = 0 i = 0
print "loop" print ":playSatelliteCount"
4.times do 4.times do
c = gpsSatelliteCount() c = gpsSatelliteCount()
if i == 0 if i == 0
@ -80,15 +112,18 @@ define :playSatelliteCount do
end end
define :playTune do define :playTune do
print ":playTune"
cue :foo cue :foo
4.times do |i| 4.times do |i|
long = (lon().abs * 10**9) % 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
4.times do 4.times do
use_synth :tb303 use_synth :tb303
play chord(:e5, :minor).choose, attack: 0, release: 0.1, cutoff: rrand_i(50, 90) + i * 10 play chord(:e3, :minor).choose, attack: 0, release: 0.1, cutoff: rrand_i(50, 90) + i * 10
sleep 0.125 sleep 0.125
end end
end end
@ -102,10 +137,11 @@ define :playTune do
use_synth :tb303 use_synth :tb303
8.times do |i| 8.times do |i|
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
use_random_seed latInt() % 1412041
4.times do 4.times do
gspeed = speed().modulo(1) gspeed = speed().modulo(1)
puts gspeed puts gspeed
play chord(:b4, :minor).choose, attack: 0, release: 0.05, cutoff: rrand_i(70, 98) + i, res: gspeed play chord(:e3, :minor).choose, attack: 0, release: 0.05, cutoff: rrand_i(70, 98) + i, res: gspeed
sleep 0.125 sleep 0.125
end end
end end
@ -118,10 +154,11 @@ define :playTune do
with_fx :reverb, mix: 0.3 do |r| with_fx :reverb, mix: 0.3 do |r|
8.times do |m| 8.times do |m|
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
use_random_seed (lonInt() + latInt()) % 2256197
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(:e6, :minor).choose, attack: 0, release: 0.08, cutoff: rrand_i(110, 130) play chord(:a3, :minor).choose, attack: 0, release: 0.08, cutoff: rrand_i(110, 130)
sleep 0.125 sleep 0.125
end end
end end
@ -133,14 +170,16 @@ define :playTune do
cue :quux cue :quux
in_thread do in_thread do
use_random_seed 668
slat = (lat().abs * 10**7).modulo(1) + 0.1
with_fx :slicer, mix: 0.75, wave: 3, phase: slat do
4.times do 4.times do
sample :bd_fat, amp: 5 sample :bd_fat, amp: 5
slat = latInt().modulo(1) + 0.1
use_random_seed lonInt() % 9562447
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(:d3, :major).choose, attack: 0, release: 0.1, cutoff: rrand(50, 100) play chord(:e3, :major).choose, attack: 0, release: 0.1, cutoff: rrand(50, 100)
sleep 0.25 sleep 0.25
end end
end end