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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>