Slide 14
Slide 14 text
def play_notes(device, current_tick) do
notes = [0x54, 0x57, 0x5B, 0x60]
delay = 4
if rem(current_tick, delay) == 0 do
index = rem(div(current_tick, delay), Enum.count(notes))
note = Enum.at(notes, index)
PortMidi.write(device, {0x90, note, volume})
Process.send_after(:midi, {:note_off, note}, 50 * 2)
end
end