Search in sources :

Example 1 with TimeSignature

use of com.xenoage.zong.core.music.time.TimeSignature in project Zong by Xenoage.

the class VoicesBeatOffsetterTest method createTestScore3VoicesGrace.

private Score createTestScore3VoicesGrace() {
    Score score = new Score();
    score.getFormat().setInterlineSpace(10);
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new TimeSignature(Companion.getTime_4_4()));
    // 2: half note, 4: quarter note, 8: eighth note, 3: quarter triplet, .: grace note
    // voice 1: | 4     ...4       4     4     |   (staff 1)
    // voice 2: | 8  8     8  8  ..2           |   (staff 1)
    // voice 3: | 3   3      3    .8  8  4     |   (staff 2)
    // voice 1 (staff 1)
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    // voice 2 (staff 1)
    cursor.setMp(atElement(0, 0, 1, 0));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 2)));
    // voice 3 (staff 2)
    cursor.setMp(atElement(1, 0, 0, 0));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(graceChord(Companion.pi(0, 0, 0)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    return score;
}
Also used : Score(com.xenoage.zong.core.Score) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Example 2 with TimeSignature

use of com.xenoage.zong.core.music.time.TimeSignature in project Zong by Xenoage.

the class VoicesBeatOffsetterTest method createTestScore3Voices.

private Score createTestScore3Voices() {
    Score score = new Score();
    score.getFormat().setInterlineSpace(10);
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new TimeSignature(Companion.getTime_4_4()));
    // 2: half note, 4: quarter note, 8: eighth note, 3: quarter triplet
    // voice 1: | 4     4     4     4     |   (staff 1)
    // voice 2: | 8  8  8  8  2           |   (staff 1)
    // voice 3: | 3   3   3   8  8  4     |   (staff 2)
    // voice 1 (staff 1)
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    // voice 2 (staff 1)
    cursor.setMp(atElement(0, 0, 1, 0));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 2)));
    // voice 3 (staff 2)
    cursor.setMp(atElement(1, 0, 0, 0));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 6)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    return score;
}
Also used : Score(com.xenoage.zong.core.Score) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Example 3 with TimeSignature

use of com.xenoage.zong.core.music.time.TimeSignature in project Zong by Xenoage.

the class VoicesBeatOffsetterTest method createTestScore1Voice.

private Score createTestScore1Voice() {
    Score score = new Score();
    score.getFormat().setInterlineSpace(1);
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new Clef(ClefType.Companion.getClefTreble()));
    cursor.write((MeasureElement) new TraditionalKey(-3));
    cursor.write(new TimeSignature(TimeType.Companion.timeType(6, 4)));
    // beats: 0, 2, 3, 4, 8.
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 2)));
    cursor.write(chord(Companion.pi(0, 0, 0), Companion.fr(1, 2)));
    return score;
}
Also used : Score(com.xenoage.zong.core.Score) Clef(com.xenoage.zong.core.music.clef.Clef) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Example 4 with TimeSignature

use of com.xenoage.zong.core.music.time.TimeSignature in project Zong by Xenoage.

the class Base42a method getExpectedStaff.

/**
 * Gets the expected musical data, but without the dynamics, fermatas, articulations and slurs.
 */
static Staff getExpectedStaff() {
    Score score = ScoreFactory.create1Staff();
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new TimeSignature(TimeType.Companion.getTime_4_4()));
    // measure 0, voice 0
    cursor.write(addLyric(chord(Companion.pi('E', 0, 5), Companion.fr(1, 2)), "This"));
    cursor.write(addLyric(chord(Companion.pi('D', 0, 5), Companion.fr(1, 4)), "is"));
    cursor.write(addLyric(chord(Companion.pi('B', 0, 4), Companion.fr(1, 4)), "the"));
    // measure 1, voice 0
    cursor.write(new Rest(Companion.fr(1, 4)));
    cursor.write(addLyric(chord(Companion.pi('D', 0, 5), Companion.fr(1, 4)), "lyrics"));
    cursor.write(addLyric(chord(Companion.pi('B', 0, 3), Companion.fr(3, 8)), "of"));
    cursor.write(addLyric(chord(Companion.pi('C', 0, 5), Companion.fr(1, 8)), "Voice1"));
    // measure 0, voice 1
    cursor.setMp(atElement(0, 0, 1, 0));
    cursor.write(addLyric(chord(Companion.pi('C', 0, 5), Companion.fr(1, 2)), "This"));
    cursor.write(addLyric(chord(Companion.pi('B', 0, 4), Companion.fr(1, 4)), "is"));
    cursor.write(addLyric(chord(Companion.pi('G', 0, 4), Companion.fr(1, 4)), "the"));
    // measure 1, voice 1
    cursor.write(new Rest(Companion.fr(1, 4)));
    cursor.write(addLyric(chord(Companion.pi('B', 0, 4), Companion.fr(1, 4)), "lyrics"));
    cursor.write(addLyric(chord(Companion.pi('G', 0, 3), Companion.fr(3, 8)), "of"));
    cursor.write(addLyric(chord(Companion.pi('A', 0, 4), Companion.fr(1, 8)), "Voice2"));
    return score.getStaff(0);
}
Also used : Score(com.xenoage.zong.core.Score) Rest(com.xenoage.zong.core.music.rest.Rest) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Example 5 with TimeSignature

use of com.xenoage.zong.core.music.time.TimeSignature in project Zong by Xenoage.

the class Base42b method getExpectedStaves.

/**
 * Gets the expected musical data, but without the dynamics, articulations and slurs
 * and also without the clef changes.
 */
static Staff[] getExpectedStaves() {
    Score score = ScoreFactory.create1Staff();
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new TimeSignature(TimeType.Companion.getTime_6_8()));
    // staff 1, measure 0
    cursor.write(chord(Companion.pi('F', 0, 4), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('D', 0, 4), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('B', 0, 3), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 3), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('F', 0, 3), Companion.fr(1, 4)));
    // staff 1, measure 1
    cursor.write(chord(Companion.pi('E', 0, 5), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('C', 0, 5), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 4), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 4), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('F', 0, 4), Companion.fr(1, 4)));
    // staff 1, measure 0
    cursor.setMp(atElement(1, 0, 0, 0));
    cursor.write(new Rest(Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 2), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 2), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('G', 0, 2), Companion.fr(1, 8)));
    cursor.write(chord(Companion.pi('A', 0, 2), Companion.fr(1, 16)));
    cursor.write(chord(Companion.pi('G', 0, 2), Companion.fr(1, 16)));
    cursor.write(chord(Companion.pi('F', 1, 2), Companion.fr(1, 16)));
    cursor.write(chord(Companion.pi('G', 0, 2), Companion.fr(1, 16)));
    // staff 1, measure 1
    cursor.write(chord(new Pitch[] { Companion.pi('C', 0, 3), Companion.pi('E', 0, 3), Companion.pi('G', 0, 3), Companion.pi('C', 0, 4) }, Companion.fr(1, 4)));
    cursor.write(new Rest(Companion.fr(1, 8)));
    cursor.write(new Rest(Companion.fr(1, 4)));
    cursor.write(chord(Companion.pi('G', 0, 3), Companion.fr(1, 8)));
    return new Staff[] { score.getStaff(0), score.getStaff(1) };
}
Also used : Score(com.xenoage.zong.core.Score) Rest(com.xenoage.zong.core.music.rest.Rest) Staff(com.xenoage.zong.core.music.Staff) Pitch(com.xenoage.zong.core.music.Pitch) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Aggregations

TimeSignature (com.xenoage.zong.core.music.time.TimeSignature)20 Score (com.xenoage.zong.core.Score)14 Cursor (com.xenoage.zong.io.selection.Cursor)12 Rest (com.xenoage.zong.core.music.rest.Rest)9 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)5 Part (com.xenoage.zong.core.music.Part)4 Clef (com.xenoage.zong.core.music.clef.Clef)4 Test (org.junit.Test)4 Fraction (com.xenoage.utils.math.Fraction)3 MeasureElementWrite (com.xenoage.zong.commands.core.music.MeasureElementWrite)3 PartAdd (com.xenoage.zong.commands.core.music.PartAdd)3 Dynamic (com.xenoage.zong.core.music.direction.Dynamic)3 lombok.val (lombok.val)3 ColumnElementWrite (com.xenoage.zong.commands.core.music.ColumnElementWrite)2 MeasureAdd (com.xenoage.zong.commands.core.music.MeasureAdd)2 Pitch (com.xenoage.zong.core.music.Pitch)2 Staff (com.xenoage.zong.core.music.Staff)2 Voice (com.xenoage.zong.core.music.Voice)2 Chord (com.xenoage.zong.core.music.chord.Chord)2 FontInfo (com.xenoage.utils.font.FontInfo)1