How can I play a note with an octave saved in a variable, like so:
my_octave = 4
play :C my_octave
How can I play a note with an octave saved in a variable, like so:
my_octave = 4
play :C my_octave
Hello @musicninja!
There are several ways to do this. Here’s a couple:
use_octave
and with_octave
functionsnote
function (which accepts an octave:
opt)More details are available in the ‘Lang’ section of the in-app help panel, under those particular function references
Happy to elaborate if you need any further help
Brilliant, thank you. I’ll use the note
function. That’s exactly what I was looking for.
# play a note and send a midi note with a different octave
use_midi_defaults ip: "127.0.0.1",
port: "tobespoke_1",
channel: "1"
use_synth :piano
foo = 0
8.times do
n = note(:C, octave: foo)
play n
midi n
foo = foo + 1
sleep 0.5
end