changing midi to midigain or midipitch based on context