fixes for transposing instruments
fix #25340
fix #4487
fixing an off-by-one error

which for some reason hasn't caused any damage, but should get fixed
anyhow