Yes, it is rather… perfect for a piece of slow anime… or as the piano repeat in a lo-fi song perhaps.
I also have a sort-of music box I’d love to find a use for… it’s no ’ elfen lied’ but it works.
Mind, it would be a lot shorter if I took out my framework, but then I wouldn’t have the control I
want… always a compromise… just play it, see what you think. Worry less about my Franken-code. 
Eli…
# Title: Music Box
# Artist: Paul 'Just Eli...' Whitfield
# Date: 17/06/2019
#
# Sonic Pi v3.1
# Eli's Framework v1.0
use_bpm 60
tracker = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
volume = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
strings = (ring :c,:c3,:c,:c2,:c1,:c )
strings1 = (ring :r, :r, :c,:c3,:c,:c2,:c1,:c )
chords = [(chord :C, :minor7), (chord :Ab, :major7), (chord :Eb, :major7), (chord :Bb, "7")].ring
c = chords[0]
# Start a loop.
define :start_loop do |i|
tracker[i] = 1
end
# Stop a loop.
define :stop_loop do |i|
tracker[i] = 0
end
# Reduce loop's volume
define :decrease_volume do |i, n |
if volume[i] - n > 0 then
volume[i] = volume[i] - n
end
end
# Increase loop's volume
define :increase_volume do |i, n |
if volume[i] + n < 10 then
volume[i] = volume[i] + n
end
end
# Violin
with_fx :flanger do
with_fx :echo do
live_loop :background_strings do
sync :piano_tinkle
if tracker[0] > 0 then
use_synth_defaults amp: volume[0]*0.25, attack: 0.5, sustain: 1, release: 1
use_synth :blade
use_transpose 12
play strings.tick
sleep 0.75
else
sleep 0.1
end
# Violin 1
live_loop :background_strings1 do
sync :piano_tinkle
if tracker[1] > 0 then
use_synth_defaults amp: volume[1]*0.25, attack: 0.5, sustain: 1, release: 1
use_synth :blade
use_transpose 36
play strings1.tick
sleep 0.75
else
sleep 0.1
end
end
end
end
end
# Music Box
with_fx :flanger do
with_fx :reverb do
live_loop :piano_tinkle do
r = [0.5, 0.6, 0.7, 0.6].choose
if tracker[2] > 0 then
use_synth :sine
use_octave +2
3.times do
play c[0], release: 0.1, amp: volume[2]*0.5, decay: 0.0125+r, sustain: r/2# play the first note of the chord
sleep 1
end
play c[2], release: 0.1, amp: volume[2]*0.5, decay: 0.0125+r, sustain: r/2 # play the third note of the chord
sleep 0.5
play c[1], release: 0.1, amp: volume[2]*0.5, decay: 0.0125+r, sustain: r/2 # # play the second note of the chord
sleep 0.5
c = chords.tick
end
sleep 0.1
end
# Music Box 1
live_loop :piano_highlight do
if tracker[3] > 0 then
sync :piano_tinkle
use_synth :sine
use_octave +2
r = [0.25, 0.25, 0.5, 1].choose
with_transpose 0 do
# play c.choose, attack: 0, decay: 1, sustain: 2, amp: volume[3]
play c.choose, release: 0.1, amp: volume[3]*0.5, decay: 0.0125+r, sustain: r/2
sleep 2
end
else
sleep 0.1
end
end
end
end
# Drums
live_loop :light_drums do
sync :piano_tinkle
if tracker[4] > 0 then
1. times do
with_fx :reverb, room:1, damp: 0.7 do
sample :drum_tom_lo_hard, rate: 1, pitch_dis: 0.001, amp: volume[4]*0.25
sleep 0.75
sample :drum_tom_lo_hard, rate: 0.5, pitch_dis: 0.001, amp: volume[4]*0.25
sleep 2
end
sleep 0.75
end
else
sleep 0.1
end
end
#__________________________________________________________________________________________________
#Code ends here...
#__________________________________________________________________________________________________
background_strings=0
background_strings1=1
piano_tinkle=2
piano_highlight=3
light_drums=4
start_loop background_strings
increase_volume background_strings,1
sleep 8
start_loop background_strings1
increase_volume background_strings1,1
sleep 8
start_loop piano_highlight
increase_volume piano_highlight,0.5
sleep 4
increase_volume piano_highlight ,0.5
sleep 4
start_loop light_drums
increase_volume light_drums,1
sleep 4
increase_volume light_drums,1
sleep 4
increase_volume light_drums,1
sleep 4
increase_volume light_drums,1
sleep 4
start_loop 2
increase_volume piano_tinkle,0.5
decrease_volume piano_highlight,0.5
sleep 4
increase_volume piano_tinkle,0.5
sleep 8
decrease_volume light_drums,1
sleep 4
decrease_volume light_drums,1
sleep 4
decrease_volume light_drums,1
decrease_volume piano_highlight,0.5
sleep 4
decrease_volume light_drums,1
decrease_volume piano_highlight,0.5
sleep 32
decrease_volume light_drums,1
decrease_volume piano_highlight,0.5
sleep 4
decrease_volume light_drums,1
decrease_volume piano_highlight,0.5
decrease_volume piano_tinkle,0.5
sleep 4
stop_loop 4
decrease_volume piano_highlight,0.5
decrease_volume piano_tinkle,0.5
sleep 4
decrease_volume piano_highlight,0.5
sleep 4
stop_loop piano_highlight
decrease_volume background_strings1,1
sleep 12
stop_loop piano_tinkle
decrease_volume background_strings1,1
sleep 8
stop_loop background_strings1
sleep 4
stop_loop background_strings