import jp.crestmuse.cmx.filewrappers.* f = CMXFileWrapper.readfile("sample.xml") dds = new DeviationDataSet(f) f.eachnote { note -> notations = note.getFirstNotations() if (note.hasArticulation("staccato")) dds.addNoteDeviation(note, 0.0, -note.actualDuration() / 2, 1.0, 1.0) if (notations != null && notations.fermata() != null) dds.addNonPartwiseControl(note.measure().number(), note.beat(), "tempo-deviation", 0.5) } dev = dds.toWrapper() dev.finalizeDocument() dev.writefile("deviation.xml") dev.toSCCXML(480).toMIDIXML().writefileAsSMF("result.mid")