Not posted much recently as I’ve been looking at build aspects of Sonic Pi. Thought it was time to make some music again, and have been coding several more old pieces from 17th century, including this lute piece from John Dowland
#Dowland-lesson-for-two-lutes.rb
#transcribed for Sonic Pi by Robin Newman, July 2020
use_synth :pluck
use_bpm 65
top=0.7 #amp for top parts
bass=0.4 #amp for bass parts
#function to play one part
define :playnotes do |nt,dur,pan,vol|
in_thread do
nt.zip(dur).each do |n,d|
play n,pan: pan,amp: bass
sleep d
end
end
end
#add some reverb
with_fx :reverb,room: 0.8,mix: 0.7 do
#use level wrapper to adjust volume
with_fx :level,amp: 0.8 do |v|
set :v,v #save reference to fx level
puts "starting level 0.8"
#use at to adjust level
at [16,32,48],[0.4,0.7,1.0] do |vol|
puts "current level #{vol}"
control get(:v),amp: vol
end
#define the notes and durations for each part
a1=[:A3,:B3,:Cs4,:D4,:r,:B3,:B3,:Cs4,:D4,:E4,:Cs4,:B3,:A3,:E3,:A3,:Gs3,:A3,:B3,:Cs4,:B3,:Cs4,:D4,:r,:E4,:D4,:Cs4,:B3,:E4,:B3,:A3,:B3,:Cs4,:D4,:B3,:E4,:D4,:Cs4,:D4,:Cs4,:B3,:A3,:E3]*2+
[:A3,:Cs4,:B3,:A3,[:Gs3,:B3],:A3,[:Gs3,:B3],:A3,:B3,:Cs4,:A3,:B3,:A3,:Gs3,:Fs3,[:Gs3,:B3],:E3,:Fs3,:Gs3,:A3,:B3,:Gs3,:A3,:Gs3,:A3,:B3,:Cs4,:B3,:Cs4,:D4,:E4,:D4,:E4,:Fs4,:E4,:D4,[:A2,:Cs4],:B3,:A3,[:A3,:B3],:Gs3,:r,:r,:A3]*2
b1=[0.75,0.25,0.5,0.5,1.0,1.0,0.5,0.5,0.5,0.5,0.75,0.25,0.5,0.5,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5,0.5,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.5,0.5]*2+
[0.5,0.5,0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4,:B4,:Gs4,:A4,:E4,:G4,:Fs4,:E4,:D4,:Cs4,:B3,:r,[:A3,:Cs4]]*2
b4=[0.75,0.25,0.5,0.5,1.0,0.5,0.5,0.5,0.5,0.5,0.5,0.75,0.25,1.0,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.75,0.25,0.5,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1.0]*2+
[0.5,0.5,0.5,0.5,1.0,0.5,0.5,0.75,0.25,0.5,0.5,1.0,0.5,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,1.0,1.0]*2+
a5=[:A3,[:E2,:B3],:E2,:A2,:r,:A2,:A2,:B3,:B3,:E2,:E2,:A2,:r]*2+
[:A2,:D3,:r,:E3,:D3,:D3,:r,:E3,:A2,:A2,:E2,:E2,:A2,:D3,:E3,[:A3,:Cs4],:D4,:r,:A2]*2
b5=[2.0,2.0,2.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]*2+
[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5,0.5,1.0,0.75,0.25,0.5,0.5]*2
a6=[:A2,:A2,:r,:r,:r,:r,:E2,:r,:r]*2+
[:r,:r,:r,:r,:r,:r,:r,:A2]*2
b6=[1.0,1.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0]*2+
[2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0]*2
#play the piece
playnotes a1,b1,-0.7,top
playnotes a2,b2,-0.7,bass
playnotes a3,b3,-0.7,bass
playnotes a4,b4,0.7,top
playnotes a5,b5,0.7,top
playnotes a6,b6,0.7,top
end #level
end#fx