1

(使用 jfugue 5.0.9)我想将.mid转换为.txt(断奏),然后再转换为.mid,以确认转换有效。.mid(原始和转换后的)在理想情况下应该相等,但转换后的(midi -> staccato -> midi)文件有奇怪的延迟音符和一个扩大的音符持续时间。JFugue 可能会遇到困难,因为 midi 是人类的超敏感录音。有没有什么办法解决这一问题?

这是 3 个文件https://drive.google.com/drive/folders/1DepX0lCqNaIRCoHRfGwBRsO1xRFCbCpl?usp=sharing

以下是使用的 2 种方法:

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();
    }
}
4

0 回答 0