Code example for ShortMessage

Methods: getData1

0
    } 
 
    // converts midi events into Note objects 
    public static byte midiToNote(ShortMessage smsg) {
 
        int semitone = smsg.getData1();
 
        if (semitone < 54) return (byte) ((semitone - 6) % (18 - 6));
        else if (semitone > 78) return (byte) ((semitone - 6) % (18 - 6) + 12);
        else return (byte) (semitone - 54);
    } 
 
    // converts midi events into pitch 
    public static double midiToPitch(ShortMessage smsg) {
 
        return noteToPitch(midiToNote(smsg));
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java