IR DISTANCE to MIDI - Help

Change that last line to:-

Serial.write(int(inches) & 0x7f); // keep the inches from going over 127