A 16th century composer I like. I coded one of his works in 2014, so thought it was time to do another (shorter) one.
#Claude Lejeune ca1528-1600 Une_puce_j'ay_dedans_l'oreille
#coded for Sonic Pi by Robin Newman
bpm = 120
use_bpm bpm
s=0.85;r=0.2 #sustain release fractions
define :playPart do |nlist,dlist,pan,vol,bpm| #play a pair of note/durations lists
use_bpm bpm
nlist.zip(dlist).each do |n,d|
play n,sustain: d*s,release: d*r,pan: pan,amp: vol
sleep d
end
end
use_synth :tri
with_fx :reverb, room: 0.7, mix: 0.6 do
with_fx :level,amp: 1 do |vc| # use for dynamic range control
set :vc,vc
#control dynamics with at list: alternate soft loud
at [12,26,46,55,61,77,95,96,108,122,142,151,157,173],[0.5,1] do |x|
control get(:vc),amp: x
end
#part/duration data follows. LAst three notes each part separate to allow for final ralentando
a1=[]
b1=[]
a1[0]=[:A4,:G4,:F4,:Bf4,:A4,:C5,:Bf4,:A4,:G4,:F4,:E4,:A4,:Bf4,:C5,:Bf4,:A4,:G4,:F4,:G4,:A4,:G4,:A4,:F4,:E4,:F4,:D4,:C4,:F4,:E4,:F4,:A4,:Bf4,:G4,:F4,:Bf4,:A4,:G4,:G4,:r,:r,:r,:r,:C5,:Bf4,:G4,:A4,:r,:A4,:G4,:A4,:B4,:C5,:r,:E4,:F4,:E4,:r,:A4,:Bf4,:C5,:Bf4,:A4,:D5,:C5,:C5,:C5,:A4,:r,:A4,:Bf4,:C5,:Bf4,:A4,:D5,:C5]
a1[1]=[:C5,:C5,:A4]
b1[0]=[1.3333334,0.6666667,1.3333334,0.6666667,1.3333334,0.6666667,1.3333334,0.6666667,1.3333334,0.6666667,2.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,2.0,2.0,1.0,2.0,1.0,1.0,2.0,1.0,2.0,0.6666667,1.3333334,0.6666667,1.3333334,0.6666667,1.3333334,1.0,2.0,4.0,0.5,0.5,0.5,0.5,2.0,1.0,1.0,2.0,2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.6666667,2.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,0.5,0.5,1.0,2.0,2.0,1.0,2.0,1.0,1.0,2.0,1.0,2.0,0.6666667,1.3333334,0.6666667,1.3333334,0.6666667,1.3333334,1.0,1.0,0.5,0.5,2.0,1.0,1.0,2.0,2.0,1.0,1.0,2.0,2.0,1.5,0.5,1.0,0.5,0.5,2.0,1.0,1.0,2.0,1.0,1.0,2.0,2.0,1.5,0.5,1.0,0.5,0.5,2.0,1.0,1.0,2.0,1.0]
b4[1]=[1.0,2.0,4.0]
#play piece through twice. UP overall volume on second play
2.times do |i|
vol = [0.5,0.9][i]
ral=[bpm,bpm-20] #flag ralentando tempo second time
in_thread do #parts played in threads so play together
playPart a1[0],b1[0],-0.9,vol,bpm
playPart a1[1],b1[1],-0.9,vol,ral[i]
end
in_thread do
playPart a2[0],b2[0],-0.3,vol,bpm
playPart a2[1],b2[1],-0.3,vol,ral[i]
end
in_thread do
playPart a3[0],b3[0],0.3,vol,bpm
playPart a3[1],b3[1],0.3,vol,ral[i]
end
playPart a4[0],b4[0],0.9,vol,bpm #4th part played without thread so repeat starts at correct time
playPart a4[1],b4[1],0.9,vol,ral[i]
sleep 1 #slight pause before repeat
end
end #level
end#reverb