local mw = require "midiwire"

print "# of devices:"
print(mw.device_count())

print "ports:"
for i=0,mw.device_count()-1 do
    print(i, mw.name(i))
end

print "open port 0:"
port = mw.open_out(0)
print(type(port), port)

print "notes: (incl sleeping)"
mw.note_on(port, 60, 127)
mw.sleep(1000)

mw.note_on(port, 62, 127)
mw.sleep(2000)

print "drums:"
mw.drum(port, 56)
mw.sleep(500)
mw.drum(port, 40)
mw.sleep(500)
mw.drum(port, 39)
mw.sleep(500)
mw.drum(port, 39)
mw.sleep(500)

print "program change:"
mw.program_change(port, 19,2)
print "channel 2:"
mw.note_on(port, 60, 127, 2)
mw.sleep(1000)
print "off:"
mw.note_off(port, 60, 2)
mw.sleep(2000)


print "reset"
mw.reset(port)


print "Alles gute!"