So I have another newbie question! What would be the best and cleanest way to play multiple notes simultaneously but keep them on the same line as to control the parameters.
Trying to streamline something like this:
"live_loop :notes do
play :f3
play :a3
play :c4
play :e4
sleep 2
play :a3
play :c4
play :e4
play :g4
sleep 2
play :e3
play :g3
play :b3
play :d4
sleep 2
play :d3
play :f3
play :a3
play :c4
sleep 1
play :e3
play :g3
play :b3
play :d4
sleep 1
end
"
there are several ways (thatās what Ruby is famous for as far as I know ). One would be something like:
live_loop :notes do
# this is a simple list: square brackets and items separated by commas
play [:f3, :a3, :c4, :e4], amp: 0.5, release: 1.5
sleep 2
# Or you can also take a ring which is effectively the same here
play (ring :a3, :c4, :e4, :g4), attack: 0.25, amp: 0.75
sleep 2
end
Uhh, yeah, chords is the keyword: If your note lists are āproperā chords (and not clusters ) you can of course do the following:
live_loop :notes do
play (chord :f3, :major7)
sleep 2
play (chord :a3, :minor7)
sleep 2
play (chord :e3, :minor7)
sleep 2
play (chord :d3, :minor7)
sleep 1
play (chord :e3, :minor7)
sleep 1
end
iāve never noticed that play can plays chords if we pass an array or a ring.
But i think itās not a good way to introduce the ring notion. In my opinion, there is no āringā into this use of ring.
Ring is used to take an element then next then next. so itās a bit weird to use ring to play chord. no ?
ok itās not weird if we consider ring as a tab. Bref. And @martin youāre right it can be useful to know the chord sends back a ring.
play (ring :c, :f, :g)
sleep 1
play (chord :c, 'major')
sleep 1
play (chord :c, 'major')[0]
sleep 1
# arpeges
len = (chord :c,'11+').length
len.times do
play (chord :c,'11+').tick
sleep 0.25
end
we can go on on arpeggio up and down since chords are ring. we can use ring functions.
puts ch = (chord :c,'11+')
puts ch_down = ch.butlast.reverse
# the go
(ch.length).times do
play ch.tick
sleep 0.25
end
# and the back
tick_reset
ch_down.length.times do
play ch_down.tick
sleep 0.25
end