Hi everyone and Terry Riley's In C

Hey everyone,

My name is Trevor, I’ve been using Sonic Pi for a couple of years for various things and I just found this forum, how cool!

I made this a year or so ago to play Terry Riley’s In C. Its a piece of music with 53 short musical figures that an ensemble of musicians repeat over and over again, each musician making the choice of when to move on to the next one. This version has 4 musicians plus the constant pulse on C.

use_bpm 110
use_random_seed 1144
#limits
a = 30
b = 40

#use this procedure to play any simple melody
define :play_fig do |figure,octave,pan, amp|
  #reset the local tick
  tick_reset(:fig_tick)
  fig_length = figure.length
  
  #loop through the notes of the outer list
  fig_length.times do
    fig_counter = tick(:fig_tick)
    #fetch the first element of the inner list
    play figure.ring[fig_counter][0]+12*octave, pan: pan, amp: amp
    #fetch the second element of the inner list
    sleep figure.ring[fig_counter][1]
  end
end

define :play_voice do |source, octave, pan,amp|
  tick_reset(:voice_tick)
  piece_length = source.length
  
  piece_length.times do
    voice_counter = tick(:voice_tick)
    k=rrand(a, b)
    k.times do
      play_fig source[voice_counter],octave,pan,amp
    end
  end
end

###############################
###############################
figmm = [[60, 0.5]]

fig01 = [[72, 0.0625], [76, 0.9375], [72, 0.0625], [76, 0.9375], [72, 0.0625], [76, 0.9375]]

fig02 = [[72, 0.0625], [76, 0.4375], [77, 0.5], [76, 1]]


fig03 = [[:r,0.5], [76, 0.5], [77, 0.5],[76, 0.5] ]

fig04 = [[:r,0.5], [76, 0.5], [77, 0.5], [79, 0.5]]

fig05 = [[76, 0.5],[77, 0.5], [79, 0.5], [:r,0.5]]

fig06 = [[84, 8]]

fig07 = [[:r, 1], [:r, 1], [:r, 1], [:r, 0.5], [72, 0.25], [72, 0.25],[72, 0.5],[:r, 0.25],[:r, 1],[:r, 1],[:r, 1],[:r, 1]]

fig08 = [[79, 6],[77, 8]]

fig09 = [[83, 0.25],[79, 0.25],[:r, 0.5],[:r, 1],[:r, 1],[:r, 1]]

fig10 = [[83, 0.25],[79, 0.25]]

fig11 = [[77, 0.25],[79, 0.25],[83, 0.25],[79, 0.25],[83, 0.25],[79, 0.25]]

fig12 = [[77, 0.5],[79, 0.5],[83, 4],[84, 1]]

fig13 = [[83,0.25],[79,0.75], [79,0.25],[77,0.25],[79,0.5],[:r,0.75], [79,3.25]]

fig14 = [[84, 4],[83, 4],[79, 4],[78, 4]]

fig15 = [[79, 0.25],[:r, 3.75]]

fig16 = [[79, 0.25],[83, 0.25], [84, 0.25],[83, 0.25]]

fig17 = [[83, 0.25],[84, 0.25],[83, 0.25],[84, 0.25],[83, 0.25],[:r, 0.25]]

fig18 = [[76, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[76, 0.75],[76, 0.25]]

fig19 = [[:r, 1.5],[91, 1.5]]

fig20 = [[76, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[67, 0.75],[76, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[76, 0.25]]

fig21 = [[76, 3]]

fig22 = [[76, 1.5],[76, 1.5],[76, 1.5],[76, 1.5],[76, 1.5],[78, 1.5],[79, 1.5],[81, 1.5],[73, 0.5]]

fig23 = [[76, 0.5],[78, 1.5],[78, 1.5],[78, 1.5],[78, 1.5],[78, 1.5], [79, 1.5],[81, 1.5],[83, 1]]

fig24 = [[76, 0.5],[78, 0.5],[79, 1.5],[79, 1.5],[79, 1.5],[79, 1.5],[79, 1.5],[81, 1.5],[83, 0.5]]

fig25 = [[76, 0.5],[78, 0.5],[79, 0.5],[81, 1.5],[81, 1.5],[81, 1.5],[81, 1.5],[81, 1.5],[83, 1.5]]

fig26 = [[76, 0.5],[78, 0.5],[79, 0.5],[81, 0.5],[83, 1.5],[83, 1.5],[83, 1.5],[83, 1.5],[83, 1.5]]

fig27 = [[76, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[79, 0.5],[76, 0.25],[79, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[76, 0.25]]

fig28 = [[76, 0.25],[78, 0.25],[76, 0.25],[78, 0.25],[76, 0.75],[76, 0.25]]

fig29 = [[76, 3],[79, 3],[84, 3]]

fig30 = [[84, 6]]

fig31 = [[79, 0.25],[77, 0.25],[79, 0.25],[83, 0.25],[79, 0.25],[83, 0.25]]

fig32 = [[77, 0.25],[79, 0.25],[77, 0.25],[79, 0.25],[83, 0.25],[77, 3.25],[79, 1.5]]

fig33 = [[79, 0.25],[77, 0.25],[:r, 0.5]]

fig34 = [[79, 0.25],[77, 0.25]]

fig35 = [[77, 0.25],[79, 0.25],[83, 0.25],[79, 0.25],[83, 0.25],[79, 0.25],[83, 0.25],[79, 0.25],[83, 0.25], [79, 0.25],[:r, 3.5],[82, 1],[91, 3], [92, 0.5],[91, 1],[95, 0.5],[93, 1.5],[91, 0.5],[88, 3], [91, 0.5],[90, 3.5],[:r, 2.5],[88, 2.5],[89, 6]]

fig36 = [[77, 0.25],[79, 0.25],[83, 0.25], [79, 0.25],[83, 0.25], [79, 0.25]]

fig37 = [[77, 0.25], [79, 0.25]]

fig38 = [[77, 0.25],[79, 0.25],[83, 0.25]]

fig39 = [[83, 0.25],[79, 0.25],[77, 0.25],[79, 0.25],[83, 0.25],[84, 0.25]]

fig40 = [[83, 0.25],[77, 0.25]]

fig41 = [[83, 0.25],[79, 0.25]]

fig42 = [[84, 4],[83, 4],[81, 4],[84, 4]]

fig43 = [[89, 0.25],[88, 0.25],[89, 0.25],[88, 0.25],[88, 0.5],[88, 0.5],[88, 0.5],[89, 0.25],[88, 0.25]]

fig44 = [[89, 0.5],[88, 1],[88, 0.5],[84, 1]]

fig45 = [[86, 1],[86, 1],[79, 1]]

fig46 = [[79, 0.25],[86, 0.25],[88, 0.25],[86, 0.25],[:r, 0.5],[79, 0.5],[:r, 0.5],[79, 0.5],[:r, 0.5],[79, 0.5],[79, 0.25],[86, 0.25],[88, 0.25],[86, 0.25]]

fig47 = [[86, 0.25],[88, 0.25],[86, 0.5]]

fig48 = [[79, 6],[79, 4],[77, 5]]

fig49 = [[77, 0.25],[79, 0.25],[82, 0.25],[79, 0.25],[82, 0.25],[79, 0.25]]

fig50 = [[77, 0.25],[79, 0.25]]

fig51 = [[77, 0.25], [79, 0.25], [82, 0.25]]

fig52 = [[79, 0.25], [82,0.25]]

fig53 = [[82, 0.25], [79,0.25]]



Figures = [fig01, fig02, fig03, fig04, fig05, fig06, fig07, fig08, fig09, fig10,
           fig11, fig12, fig13, fig14, fig15, fig16, fig17, fig18, fig19, fig20,
           fig21, fig22, fig23, fig24, fig25, fig26, fig27, fig28, fig29, fig30,
           fig31, fig32, fig33, fig34, fig35, fig36, fig37, fig38, fig39, fig40,
           fig41, fig42, fig43, fig44, fig45, fig46, fig47, fig48, fig49, fig50,
           fig51, fig52, fig53]


###############################
###############################


in_thread do
  use_synth :kalimba
  loop do
    play_fig figmm, 0, 0, 1
  end
end

in_thread do
  use_synth :pluck
  tick_reset(:voice1_tick)
  piece_length=Figures.length
  sleep 4*rrand_i(3,5)
  
  piece_length.times do
    voice1_counter = tick(:voice1_tick)
    k1=rrand_i(a,b)
    a1 = rrand(0.1,0.4)
    k1.times do
      play_fig Figures[voice1_counter], 0, -0.25, a1
    end
  end
end

in_thread do
  use_synth :piano
  tick_reset(:voice2_tick)
  piece_length=Figures.length
  sleep 4*rrand_i(3,5)
  
  piece_length.times do
    voice2_counter = tick(:voice2_tick)
    k2=rrand_i(a,b)
    a2 = rrand(0.1,0.4)
    k2.times do
      play_fig Figures[voice2_counter], -1, 0.25, a2
    end
  end
end

in_thread do
  use_synth :piano
  tick_reset(:voice3_tick)
  piece_length=Figures.length
  sleep 4*rrand_i(3,5)
  
  piece_length.times do
    voice3_counter = tick(:voice3_tick)
    k3=rrand_i(a,b)
    a3 = rrand(0.1,0.4)
    k3.times do
      play_fig Figures[voice3_counter], 0, -0.75, a3
    end
  end
end

in_thread do
  use_synth :pluck
  tick_reset(:voice4_tick)
  piece_length=Figures.length
  sleep 4*rrand_i(3,5)
  
  piece_length.times do
    voice4_counter = tick(:voice4_tick)
    k4=rrand_i(a,b)
    a4 = rrand(0.1,0.4)
    k4.times do
      play_fig Figures[voice4_counter], -1, 0.75, a4
    end
  end
end

1 Like

Very cool!
I’d never seen anyone name the ticks before. That’s a useful trick.

Very nice indeed! This brings back memories too - myself and an ensemble of disabled musicians performed it 20 years ago, at a Stockhausen concert in Belfast.

Now do 4’33’’ by Cage :smiley:

PD-Pi

1 Like

Ah, I did copy that approach to playing melodies from somewhere, I can’t find where I got it from, but I’ll look and try to cite it.

Found it!