use of com.xenoage.zong.musicxml.types.MxlSyllabicText in project Zong by Xenoage.
the class LyricReader method readLyrics.
private List<Lyric> readLyrics() {
// not supported yet: in MusicXML also rests can have lyrics. see measure 36 in Echigo-Jishi
List<Lyric> ret = alist();
for (MxlNote mxlNote : mxlNotes) {
for (MxlLyric mxlLyric : it(mxlNote.getLyrics())) {
int verse = readVerse(mxlLyric);
MxlLyricContentType mxlLCType = mxlLyric.getContent().getLyricContentType();
if (mxlLCType == MxlLyricContentType.SyllabicText) {
MxlSyllabicText mxlSyllabicText = (MxlSyllabicText) mxlLyric.getContent();
SyllableType syllableType = readSyllableType(mxlLyric);
// the next element must be the text element
ret.add(new Lyric(Companion.ut(mxlSyllabicText.getText().getValue()), syllableType, verse));
} else if (mxlLCType == MxlLyricContentType.Extend) {
// extend - TODO: extension to next chord!
ret.add(Lyric.Companion.lyricExtend(verse));
}
}
}
return ret;
}
use of com.xenoage.zong.musicxml.types.MxlSyllabicText in project Zong by Xenoage.
the class Test01c method test.
@Test
public void test() {
MxlMeasure measure = getFirstMeasure();
for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
if (data.getMusicDataContentType() == MxlMusicDataContentType.Note) {
// check pitch
MxlNote note = (MxlNote) data;
MxlFullNote fullNote = note.getContent().getFullNote();
MxlPitch pitch = (MxlPitch) (fullNote.getContent());
assertEquals(Companion.pi('G', 0, 4), pitch.getPitch());
// check lyric
assertEquals(1, note.getLyrics().size());
assertEquals("A", ((MxlSyllabicText) note.getLyrics().get(0).getContent()).getText().getValue());
return;
}
}
fail("note not found");
}
Aggregations