Search in sources :

Example 1 with MxlSyllabicText

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;
}
Also used : MxlLyric(com.xenoage.zong.musicxml.types.MxlLyric) MxlLyric(com.xenoage.zong.musicxml.types.MxlLyric) Lyric(com.xenoage.zong.core.music.lyric.Lyric) SyllableType(com.xenoage.zong.core.music.lyric.SyllableType) MxlSyllabicText(com.xenoage.zong.musicxml.types.MxlSyllabicText) MxlNote(com.xenoage.zong.musicxml.types.MxlNote) MxlLyricContentType(com.xenoage.zong.musicxml.types.choice.MxlLyricContent.MxlLyricContentType)

Example 2 with MxlSyllabicText

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");
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlFullNote(com.xenoage.zong.musicxml.types.groups.MxlFullNote) MxlPitch(com.xenoage.zong.musicxml.types.MxlPitch) MxlSyllabicText(com.xenoage.zong.musicxml.types.MxlSyllabicText) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) MxlNote(com.xenoage.zong.musicxml.types.MxlNote) Test(org.junit.Test)

Aggregations

MxlNote (com.xenoage.zong.musicxml.types.MxlNote)2 MxlSyllabicText (com.xenoage.zong.musicxml.types.MxlSyllabicText)2 Lyric (com.xenoage.zong.core.music.lyric.Lyric)1 SyllableType (com.xenoage.zong.core.music.lyric.SyllableType)1 MxlLyric (com.xenoage.zong.musicxml.types.MxlLyric)1 MxlPitch (com.xenoage.zong.musicxml.types.MxlPitch)1 MxlLyricContentType (com.xenoage.zong.musicxml.types.choice.MxlLyricContent.MxlLyricContentType)1 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)1 MxlFullNote (com.xenoage.zong.musicxml.types.groups.MxlFullNote)1 MxlMeasure (com.xenoage.zong.musicxml.types.partwise.MxlMeasure)1 Test (org.junit.Test)1