Reichish Phase

This is a tribute to the early music of Steve Reich. It was realized on the Sonic Pi, using the Bohlen-Pierce scale, equal tempered as MIDI notes.

 

Source code:

# Reichish Phase

tritave = 19.02 # a 3/2 tritave is 1902 cents, or 19.02 in MIDI
half = tritave / 13 # size of the BP half step in MIDI
whole = half * 2

a3 = 69 # MIDI 69 is A440
b3 = a3 + whole
c3 = b3 + half
d3 = c3 + whole
e3 = d3 + half
f3 = e3 + half
g3 = f3 + whole
h3 = g3 + half
j3 = h3 + whole
a4 = a3 + tritave

a2 = a3 - tritave
b2 = b3 - tritave
c2 = c3 - tritave
d2 = d3 - tritave
e2 = e3 - tritave
f2 = f3 - tritave
g2 = g3 - tritave
h2 = h3 - tritave
j2 = j3 - tritave

notes = (ring a2, a3, f2, c2, c3, h2, e2, e3, b2, g2, g3, d2, j2)

in_thread(name: :slower) do
use_synth :pretty_bell
for i in 0..326
print i
n = notes.tick
np = n / a4
play n, amp: 1.0 - np, pan: -np / 2
sleep rrand(0.298,0.302)
i +=1
end
end

in_thread(name: :faster) do
use_synth :pretty_bell
for i in 0..329
print i
n = notes.tick
np = n / a4
play n, amp: 1.0 - np, pan: np / 2
sleep rrand(0.294,0.3)
i +=1
end
end

More BP on the Sonic Pi

Using a sampled A=440Hz piano note, I squished and stretched it to play¬†a BP chromatic scale. Here it is juxtaposed against random MIDI BP notes using the Sonic Pi’s FM synth.

Code:

# Bohlen-Pierce notes

tritave = 19.02         # a 3/2 tritave is 1902 cents, or 19.02 in MIDI
half = tritave / 13     # size of the BP half step in MIDI
whole = half * 2

a = 69  # MIDI 69 is A440
b = a + whole
c = b + half
d = c + whole
e = d + half
f = e + half
g = f + whole
h = g + half
j = h + whole
a_ = a + tritave

bpScale = [a,b,c,d,e,f,g,h,j,a_]

exp = 3 ** (1.0/13)

# play random notes with FM synth

divs = [1.0/exp,exp,1] # divisors add random BP flavor for FM synth
in_thread do
  use_synth :fm
  for i in 0..48
    highN = bpScale.choose
    lowN = highN - tritave
    play highN, divisor: divs.choose, depth: 0.5, pan: 49/highN, amp: rrand(0.1,0.2), attack: rrand(0,0.01), sustain: 0.2, release: rrand(0.1,0.5)
    sleep 0.15
    play lowN,  divisor: divs.choose, depth: 0.7, pan: -34/lowN, amp: rrand(0.1,0.2), attack: rrand(0,0.01), sustain: 0.2, release: rrand(0.1,0.5)
    sleep 0.15
  end 
end

# play chromatic BP scale with sampled piano

speed = 5.0/9 # initial sample speed yields BP E note (JI) calculated from A=440Hz
for i in 1..36
  sample "~/Sonic Pi/piano-a440.wav", rate: speed, pan: speed - 1.5, amp: rrand(1.0/3,2.0/3)
  speed = i < 18 ? speed * exp : speed / exp
  sleep 0.4
end