JFugue converts midi file incorrectly

146 views Asked by At

(using jfugue 5.0.9) I wanted to convert .mid to .txt (staccato), and later to .mid again, to confirm conversions worked. Both .mid (original and converted) should be equal ideally, but the converted (midi -> staccato -> midi) file has weird delayed notes, and one enlargened note duration. JFugue probably struggles because the midi is a human, hyper-sensible recording. Is there any way to fix this?

Heres the 3 files https://drive.google.com/drive/folders/1DepX0lCqNaIRCoHRfGwBRsO1xRFCbCpl?usp=sharing

And here are the 2 methods used:

public static Pattern convMidToStac(String fileName, boolean makeAFile) {
    
    Pattern p = new Pattern();
    
    // Convert midi file to a JFugue Staccato pattern.
    try {
        p = MidiFileManager.loadPatternFromMidi(new File("D:/eclipse-workspace/MidiReader/" + fileName + ".mid"));
        
        if (makeAFile) {
            makeFile(fileName, p.toString());
        }
        return p;
        
    } catch (Exception e) {
        System.out.println("An error occurred.");
        e.printStackTrace();
        
        return null;
    }
}

public static void convStacToMid(String fileName) {
    
    Pattern p = new Pattern();
    
    try {
        p = MidiFileManager.loadPatternFromMidi(new File("D:/eclipse-workspace/MidiReader/" + fileName + ".mid"));
        
        File filePath = new File("D:/eclipse-workspace/MidiReader/" + fileName + "MIDI.mid");            
        
        MidiFileManager.savePatternToMidi(p, filePath);
        
    } catch (Exception e) {
        e.printStackTrace();
    }
}
0

There are 0 answers