"Rational Melodies" by Tom Johnson

Hi! Yesterday I was listening to the Rational Melodies by the minimalist composer Tom Johnson. Now I’m thinking how can I write the code for the first piece:

As you can see, there’s only a few notes, repeated almost equally, but with a little change in each measure (the rests change their place). How could I write a code to play it with the option of changing the notes? Thanks!

Do you have any initial thoughts about the kinds of “building blocks” that you could use/you might need to make it work? :slightly_smiling_face:


I realized that we need to insert some rests at a changing position so here is what I suggest to answer your question

notes = [:d, :a, :b, :f5, :b, :a]

p1 = *notes
pattern_01 = p1.insert(1, :r)
pattern_01 = p1.insert(7, :r)
puts pattern_01
puts notes

p2 = *notes
pattern_02 = p2.insert(2, :r)
pattern_02 = p2.insert(7, :r)
puts pattern_02

p3 = *notes
pattern_03 = p3.insert(3, :r)
pattern_03 = p3.insert(7, :r)
puts pattern_03

use_synth :piano
use_synth_defaults sustain: 1, release: 1

play_pattern_timed pattern_01, 0.5
play_pattern_timed pattern_02, 0.5
play_pattern_timed pattern_03, 0.5


I’ve been trying with play_pattern without success. After the ideas of nlb, now I can complete the piece. I’ll share it when I finish it, thanks!


That’s it! Thank you so much! I’ll share the complete piece soon :slight_smile: