public InputStream getPieceMusicXml(long id) throws IOException {
Piece piece = dao.getById(Piece.class, id);
try (InputStream is = fileStorageService.getFile(getMidiFilePath(id))) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
Score score = new Score();
SMFTools localSMF = new SMFTools();
localSMF.read(is);
SMFTools.SMFToScore(score, localSMF);
score.setTitle(piece.getTitle());
score.setNumerator(piece.getMetreNumerator());
score.setDenominator(piece.getMetreDenominator());
MusicXmlRenderer.render(score, result);