moved midi messaging outside the update function