Search in sources :

Example 11 with TraditionalKey

use of com.xenoage.zong.core.music.key.TraditionalKey in project Zong by Xenoage.

the class StrategyTest method getScore.

@Override
public Score getScore() {
    // collect test material
    List<Example> examples = getAllExamples();
    // text style
    FormattedTextStyle style = defaultStyle.withFont(new FontInfo("Arial", 6f, FontStyle.normal));
    // one chord in each measure
    Score score = ScoreFactory.create1Staff();
    Cursor cursor = new Cursor(score, mp0, true);
    cursor.write(new TimeSignature(TimeType.time_3_4));
    for (int i : range(examples)) {
        Example example = examples.get(i);
        cursor.setMp(atElement(0, i, 0, 0));
        // write key
        int fifths = ((TraditionalKey) example.getContext().getKey()).getFifths();
        cursor.write((ColumnElement) new TraditionalKey(fifths));
        // write example name (each 2nd example one line down for better reading)
        String text = (i % 2 == 1 ? "\n" : "") + example.getName();
        cursor.write((MeasureElement) new Words(styleText(text, style)));
        // write chord with all accidentals from context (or a rest)
        Map<Pitch, Integer> accs = example.getContext().getAccidentals();
        if (accs.size() > 0) {
            Pitch[] pitches = new Pitch[accs.size()];
            int accIndex = 0;
            for (Pitch acc : accs.keySet()) {
                pitches[accIndex] = pi(acc.getStep(), accs.get(acc), acc.getOctave());
                accIndex++;
            }
            Chord accsChords = ChordFactory.chord(pitches, _1$4);
            cursor.write(accsChords);
        } else {
            cursor.write(new Rest(_1$4));
        }
        // write a rest
        cursor.write(new Rest(_1$4));
        // write the tested chord
        Chord testedChord = ChordFactory.chord(example.getPitches().toArray(new Pitch[0]), _1$4);
        cursor.write(testedChord);
    }
    return score;
}
Also used : FormattedTextStyle(com.xenoage.zong.core.text.FormattedTextStyle) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Cursor(com.xenoage.zong.io.selection.Cursor) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature) Score(com.xenoage.zong.core.Score) Rest(com.xenoage.zong.core.music.rest.Rest) Example(material.accidentals.Example) Words(com.xenoage.zong.core.music.direction.Words) Pitch(com.xenoage.zong.core.music.Pitch) FontInfo(com.xenoage.utils.font.FontInfo) Chord(com.xenoage.zong.core.music.chord.Chord)

Example 12 with TraditionalKey

use of com.xenoage.zong.core.music.key.TraditionalKey in project Zong by Xenoage.

the class MeasureElementsSpacer method compute.

List<ElementSpacing> compute(BeatEList<Clef> clefs, @MaybeEmpty BeatEList<Key> keys, @MaybeNull TimeSignature time, boolean existsLeadingSpacing, List<VoiceSpacing> voiceSpacings, int staff, Notations notations, LayoutSettings layoutSettings) {
    Key key0 = null;
    if (keys.size() > 0 && keys.getFirst().beat.equals(_0))
        key0 = keys.getFirst().element;
    if (key0 == null && time == null && (clefs == null || clefs.size() == 0)) {
        // nothing to do
        return empty;
    }
    ArrayList<ElementSpacing> ret = alist();
    float startOffset = layoutSettings.offsetMeasureStart;
    // key and time
    // ************
    boolean isKey = !existsLeadingSpacing && key0 instanceof TraditionalKey;
    boolean isTime = time != null;
    if (isKey || isTime) {
        float currentOffset = startOffset;
        // ***
        if (isKey) {
            Notation keyNotation = notations.get(key0, staff);
            ret.add(new SimpleSpacing(keyNotation, _0, startOffset));
            currentOffset += keyNotation.getWidth().getUsedWidth();
        }
        // ****
        if (time != null) {
            Notation timeNotation = notations.get(time, staff);
            ret.add(new SimpleSpacing(timeNotation, _0, currentOffset + timeNotation.getWidth().symbolWidth / 2));
            currentOffset += timeNotation.getWidth().getUsedWidth();
        }
        // move voice elements, if not enough space before first voice element
        ElementSpacing leftSE = getFirstElementSpacing(voiceSpacings);
        if (leftSE != null) {
            float leftSEx = getLeftX(leftSE);
            // existing space
            float ES = leftSEx;
            // additional needed space
            float AS = currentOffset - ES;
            if (AS > 0) {
                shift(voiceSpacings, AS);
                startOffset += AS;
            }
        }
    }
    // voice 2:       1             o
    if (clefs != null) {
        for (BeatE<Clef> ME : clefs) {
            Fraction MEb = ME.beat;
            Notation MEnotation = notations.get(ME.element);
            float MEwidth = MEnotation.getWidth().getWidth();
            // if there is a leading spacing, ignore elements at beat 0
            if (existsLeadingSpacing && !MEb.isGreater0())
                continue;
            // find VE1 and VE2 for the current element
            ElementSpacing[] ses = getNearestSpacingElements(MEb, voiceSpacings);
            ElementSpacing VE1 = ses[0], VE2 = ses[1];
            // if VE1 is unknown, use startOffset. if VE2 is unknown, ignore this element
            float VE1x = (VE1 != null ? getRightX(VE1) : startOffset);
            if (VE2 == null)
                continue;
            float VE2x = getLeftX(VE2);
            // existing space
            float ES = VE2x - VE1x - 2 * layoutSettings.spacings.widthDistanceMin;
            if (ES < MEwidth) {
                // additional space needed
                float AS = MEwidth - ES;
                // move all elements at or after ME.beat
                VE2x += AS;
                shiftAfterBeat(voiceSpacings, AS, MEb);
            }
            // add measure element
            float MEx = VE2x - layoutSettings.spacings.widthDistanceMin - MEwidth / 2;
            ret.add(new SimpleSpacing(MEnotation, ME.beat, MEx));
        }
    }
    ret.trimToSize();
    return ret;
}
Also used : ElementSpacing(com.xenoage.zong.musiclayout.spacing.ElementSpacing) SimpleSpacing(com.xenoage.zong.musiclayout.spacing.SimpleSpacing) Clef(com.xenoage.zong.core.music.clef.Clef) Fraction(com.xenoage.utils.math.Fraction) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Notation(com.xenoage.zong.musiclayout.notation.Notation) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Key(com.xenoage.zong.core.music.key.Key)

Example 13 with TraditionalKey

use of com.xenoage.zong.core.music.key.TraditionalKey in project Zong by Xenoage.

the class LeadingSpacer method compute.

/**
 * Computes the {@link LeadingSpacing} for the current measure.
 */
public LeadingSpacing compute(Context context, Notations notations) {
    float xOffset = context.settings.offsetMeasureStart;
    boolean useKey = false;
    MusicContext musicContext = context.getMusicContext(At, null);
    Key key = musicContext.getKey();
    if (key instanceof TraditionalKey) {
        useKey = true;
    }
    List<ElementSpacing> elements = alist(useKey ? 2 : 1);
    // it is not the same element instance, but has the same meaning
    Clef clef = new Clef(musicContext.getClef());
    ClefNotation clefNotation = new ClefNotation(clef, new ElementWidth(0, context.settings.spacings.widthClef, 0), musicContext.getClef().getLp(), 1);
    notations.add(clefNotation);
    xOffset += context.settings.spacings.widthClef / 2;
    elements.add(new SimpleSpacing(clefNotation, fr(0), xOffset));
    xOffset += context.settings.spacings.widthClef / 2;
    if (useKey) {
        TraditionalKey tkey = (TraditionalKey) key;
        xOffset += context.settings.spacings.widthDistanceMin;
        // it is not the same element instance, but has the same meaning
        TraditionalKey tradKey = new TraditionalKey(tkey.getFifths(), tkey.getMode());
        TraditionalKeyNotation keyNotation = traditionalKeyNotator.compute(tradKey, context);
        notations.add(keyNotation);
        elements.add(new SimpleSpacing(keyNotation, fr(0), xOffset));
        xOffset += keyNotation.getWidth().getWidth();
    }
    return new LeadingSpacing(elements, xOffset);
}
Also used : ElementWidth(com.xenoage.zong.musiclayout.spacing.ElementWidth) LeadingSpacing(com.xenoage.zong.musiclayout.spacing.LeadingSpacing) SimpleSpacing(com.xenoage.zong.musiclayout.spacing.SimpleSpacing) Clef(com.xenoage.zong.core.music.clef.Clef) ClefNotation(com.xenoage.zong.musiclayout.notation.ClefNotation) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) MusicContext(com.xenoage.zong.core.music.MusicContext) ElementSpacing(com.xenoage.zong.musiclayout.spacing.ElementSpacing) TraditionalKeyNotation(com.xenoage.zong.musiclayout.notation.TraditionalKeyNotation) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Key(com.xenoage.zong.core.music.key.Key)

Example 14 with TraditionalKey

use of com.xenoage.zong.core.music.key.TraditionalKey in project Zong by Xenoage.

the class ScoreReader method readToScore.

public void readToScore(Score score, ErrorHandling errorHandling) {
    Context context = new Context(score, new ReaderSettings(errorHandling));
    // create the measures of the parts
    It<MxlPart> mxlParts = it(doc.getParts());
    for (MxlPart mxlPart : mxlParts) {
        // create measures
        execute(new MeasureAddUpTo(score, mxlPart.getMeasures().size()));
        // initialize each measure with a C clef
        Part part = score.getStavesList().getParts().get(mxlParts.getIndex());
        StavesRange stavesRange = score.getStavesList().getPartStaffIndices(part);
        for (int staff : stavesRange.getRange()) {
            execute(new MeasureElementWrite(new Clef(ClefType.clefTreble), score.getMeasure(MP.atMeasure(staff, 0)), _0));
        }
    }
    // write a 4/4 measure and C key signature in the first measure
    execute(new ColumnElementWrite(new TimeSignature(TimeType.time_4_4), score.getColumnHeader(0), _0, null));
    execute(new ColumnElementWrite(new TraditionalKey(0), score.getColumnHeader(0), _0, null));
    // read the parts
    mxlParts = it(doc.getParts());
    for (MxlPart mxlPart : mxlParts) {
        // clear part-dependent context values
        context.beginNewPart(mxlParts.getIndex());
        // read the measures
        It<MxlMeasure> mxlMeasures = it(mxlPart.getMeasures());
        for (MxlMeasure mxlMeasure : mxlMeasures) {
            try {
                MeasureReader.readToContext(mxlMeasure, mxlMeasures.getIndex(), context);
            } catch (MusicReaderException ex) {
                throw new RuntimeException("Error at " + ex.getContext().toString(), ex);
            } catch (Exception ex) {
                throw new RuntimeException("Error (roughly) around " + context.toString(), ex);
            }
        }
    }
    // remove unclosed elements
    context.removeUnclosedWedges();
    // go through the whole score, and fill empty measures (that means, measures where
    // voice 0 has no single VoiceElement) with rests
    Fraction measureDuration = fr(1, 4);
    for (int iStaff = 0; iStaff < score.getStavesCount(); iStaff++) {
        Staff staff = score.getStaff(atStaff(iStaff));
        for (int iMeasure : range(staff.getMeasures())) {
            Measure measure = staff.getMeasure(iMeasure);
            TimeSignature newTime = score.getHeader().getColumnHeader(iMeasure).getTime();
            if (newTime != null) {
                // time signature has changed
                measureDuration = newTime.getType().getMeasureBeats();
            }
            if (measureDuration == null) {
                // senza misura
                // use whole rest
                measureDuration = fr(4, 4);
            }
            Voice voice0 = measure.getVoice(0);
            if (voice0.isEmpty()) {
                // TODO: "whole rests" or split. currently, also 3/4 rests are possible
                MP mp = atElement(iStaff, iMeasure, 0, 0);
                new VoiceElementWrite(score.getVoice(mp), mp, new Rest(measureDuration), null).execute();
            }
        }
    }
}
Also used : VoiceElementWrite(com.xenoage.zong.commands.core.music.VoiceElementWrite) MP.atStaff(com.xenoage.zong.core.position.MP.atStaff) Staff(com.xenoage.zong.core.music.Staff) ColumnElementWrite(com.xenoage.zong.commands.core.music.ColumnElementWrite) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) Clef(com.xenoage.zong.core.music.clef.Clef) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) MeasureAddUpTo(com.xenoage.zong.commands.core.music.MeasureAddUpTo) StavesRange(com.xenoage.zong.core.music.group.StavesRange) Rest(com.xenoage.zong.core.music.rest.Rest) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) Measure(com.xenoage.zong.core.music.Measure) MP(com.xenoage.zong.core.position.MP) MusicReaderException(com.xenoage.zong.io.musicxml.in.util.MusicReaderException) Fraction(com.xenoage.utils.math.Fraction) MusicReaderException(com.xenoage.zong.io.musicxml.in.util.MusicReaderException) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) Part(com.xenoage.zong.core.music.Part) MeasureElementWrite(com.xenoage.zong.commands.core.music.MeasureElementWrite) Voice(com.xenoage.zong.core.music.Voice)

Example 15 with TraditionalKey

use of com.xenoage.zong.core.music.key.TraditionalKey in project Zong by Xenoage.

the class ScoreRevolutionary method createScore.

public static Score createScore() {
    Score score = new Score();
    Instrument instr = Instrument.defaultInstrument;
    float is = score.getFormat().getInterlineSpace();
    StaffLayout staffLayout = new StaffLayout(is * 9);
    score.getFormat().setStaffLayoutOther(staffLayout);
    ArticulationType[] accent = { ArticulationType.Accent };
    ArticulationType[] staccato = { ArticulationType.Staccato };
    Fraction f2 = fr(1, 2);
    Fraction f4 = fr(1, 4);
    Fraction f8 = fr(1, 8);
    Fraction f16 = fr(1, 16);
    Chord attachC, firstSlurC, lastSlurC;
    BezierPoint firstSlurB, lastSlurB;
    Part pianoPart = new Part("Piano", null, 2, alist(instr));
    new PartAdd(score, pianoPart, 0, null).execute();
    // set barlines and brackets
    new BarlineGroupAdd(score.getStavesList(), new BarlineGroup(new StavesRange(0, 1), BarlineGroup.Style.Common)).execute();
    new BracketGroupAdd(score.getStavesList(), new BracketGroup(new StavesRange(0, 1), BracketGroup.Style.Bracket)).execute();
    // use cursor for more convenient input
    Cursor cursor = new Cursor(score, MP.mp0, true);
    // C minor, C (4/4) time
    cursor.write((ColumnElement) new TraditionalKey(-3, Mode.Minor));
    cursor.write(new TimeSignature(TimeType.timeCommon));
    // first staff: g-clef and some notes
    cursor.write(new Clef(ClefType.clefTreble));
    // measure 1
    // , , FontInfo.defaultValue, );
    Tempo tempo = new Tempo(f4, 160);
    tempo.setText(ut("Allegro con fuoco."));
    tempo.setPositioning(new Position(null, 22f, -5f, -5f));
    cursor.write((ColumnElement) tempo);
    cursor.write(attachC = chord(f2, accent, pi(B, 4), pi(D, 5), pi(F, 5), pi(G, 5), pi(B, 5)));
    attachC.setDirections(addOrNew(attachC.getDirections(), new Dynamic(DynamicValue.f)));
    cursor.write(new Rest(f2));
    // measure 2
    cursor.write(new Rest(f2));
    cursor.write(new Rest(f4));
    Wedge cresc = new Wedge(WedgeType.Crescendo);
    cresc.setPositioning(new Position(null, null, -1f, -2f));
    cursor.write((MeasureElement) cresc);
    cursor.openBeam();
    cursor.write(firstSlurC = chord(fr(3, 16), accent, pi(A, -1, 4), pi(E, -1, 5), pi(F, 5), pi(A, -1, 5)));
    cursor.write(lastSlurC = chord(f16, pi(G, 4), pi(G, 5)));
    cursor.closeBeam();
    cursor.write((MeasureElement) cresc.getWedgeEnd());
    firstSlurB = new BezierPoint(sp(is * 0.8f, is * 7.6f), sp(is, is * 0.8f));
    lastSlurB = new BezierPoint(sp(0, is * 6f), sp(-is, is));
    new SlurAdd(new Slur(SlurType.Slur, clwp(firstSlurC, firstSlurB), clwp(lastSlurC, lastSlurB), null)).execute();
    // measure 3
    cursor.write(attachC = chord(f2, pi(D, 5), pi(F, 5), pi(G, 5), pi(D, 6)));
    new DirectionAdd(new Dynamic(DynamicValue.f), attachC).execute();
    cursor.write(new Rest(f2));
    // measure 4
    cursor.write(new Rest(f2));
    cursor.write(new Rest(f4));
    cresc = new Wedge(WedgeType.Crescendo);
    cresc.setPositioning(new Position(null, null, -1f, -2f));
    cursor.write((MeasureElement) cresc);
    cursor.openBeam();
    cursor.write(firstSlurC = chord(fr(3, 16), accent, pi(A, -1, 4), pi(E, -1, 5), pi(F, 0, 5), pi(A, -1, 5)));
    cursor.write(lastSlurC = chord(f16, pi(G, 0, 4), pi(G, 0, 5)));
    cursor.closeBeam();
    cursor.write((MeasureElement) cresc.getWedgeEnd());
    firstSlurB = new BezierPoint(sp(is * 0.8f, is * 7.6f), sp(is, is * 0.8f));
    lastSlurB = new BezierPoint(sp(0, is * 6f), sp(-is, is));
    new SlurAdd(new Slur(SlurType.Slur, clwp(firstSlurC, firstSlurB), clwp(lastSlurC, lastSlurB), null)).execute();
    // measure 5
    cursor.write(attachC = chord(f4, staccato, pi(F, 5), pi(G, 5), pi(D, 6), pi(F, 6)));
    new DirectionAdd(new Dynamic(DynamicValue.f), attachC).execute();
    cursor.write(new Rest(f4));
    cursor.write(new Rest(f2));
    // second staff: f-clef some notes
    cursor = new Cursor(cursor.getScore(), mp(1, 0, 0, _0, 0), true);
    cursor.write(new Clef(ClefType.clefBass));
    // measure 1
    cursor.openBeam();
    cursor.write(new Rest(f8));
    cursor.write(firstSlurC = chord(f16, pi(A, -1, 4)));
    cursor.write(chord(f16, pi(G, 0, 4)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 4)));
    cursor.write(chord(f16, pi(D, 0, 4)));
    cursor.write(chord(f16, pi(E, -1, 4)));
    cursor.write(chord(f16, pi(D, 0, 4)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(B, 0, 3)));
    cursor.write(chord(f16, pi(G, 0, 3)));
    cursor.write(chord(f16, pi(A, -1, 3)));
    cursor.write(chord(f16, pi(G, 0, 3)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 3)));
    cursor.write(chord(f16, pi(D, 0, 3)));
    cursor.write(chord(f16, pi(E, -1, 3)));
    cursor.write(chord(f16, pi(D, 0, 3)));
    cursor.closeBeam();
    // measure 2
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(B, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 2)));
    cursor.write(chord(f16, pi(A, -1, 2)));
    cursor.write(chord(f16, pi(G, 0, 2)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 2)));
    cursor.write(chord(f16, pi(D, 0, 2)));
    cursor.write(chord(f16, pi(E, -1, 2)));
    cursor.write(chord(f16, pi(D, 0, 2)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.write(chord(f16, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.write(chord(f16, pi(C, 0, 2)));
    cursor.write(lastSlurC = chord(f16, pi(G, 0, 1)));
    cursor.closeBeam();
    firstSlurB = new BezierPoint(sp(0, is * 1.5f), sp(15, 5));
    lastSlurB = new BezierPoint(sp(0, is * 7.5f), sp(-is * 5, is * 2));
    new SlurAdd(new Slur(SlurType.Slur, clwp(firstSlurC, firstSlurB), clwp(lastSlurC, lastSlurB), null)).execute();
    // measure 3
    cursor.write(chord(f8, staccato, pi(B, 0, 1)));
    cursor.openBeam();
    cursor.write(firstSlurC = chord(f16, pi(A, -1, 4)));
    cursor.write(chord(f16, pi(G, 0, 4)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 4)));
    cursor.write(chord(f16, pi(D, 0, 4)));
    cursor.write(chord(f16, pi(E, -1, 4)));
    cursor.write(chord(f16, pi(D, 0, 4)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(B, 0, 3)));
    cursor.write(chord(f16, pi(G, 0, 3)));
    cursor.write(chord(f16, pi(A, -1, 3)));
    cursor.write(chord(f16, pi(G, 0, 3)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 3)));
    cursor.write(chord(f16, pi(D, 0, 3)));
    cursor.write(chord(f16, pi(E, -1, 3)));
    cursor.write(lastSlurC = chord(f16, pi(D, 0, 3)));
    cursor.closeBeam();
    firstSlurB = new BezierPoint(sp(0, is * 1.5f), sp(15, 3));
    lastSlurB = new BezierPoint(sp(0, is * 5f), sp(-is * 5.5f, is * 2));
    new SlurAdd(new Slur(SlurType.Slur, clwp(firstSlurC, firstSlurB), clwp(lastSlurC, lastSlurB), null)).execute();
    // measure 4
    cursor.openBeam();
    cursor.write(firstSlurC = chord(f16, accent, pi(B, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 2)));
    cursor.write(chord(f16, pi(A, -1, 2)));
    cursor.write(chord(f16, pi(G, 0, 2)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(F, 0, 2)));
    cursor.write(chord(f16, pi(D, 0, 2)));
    cursor.write(chord(f16, pi(E, -1, 2)));
    cursor.write(chord(f16, pi(D, 0, 2)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.write(chord(f16, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.closeBeam();
    cursor.openBeam();
    cursor.write(chord(f16, accent, pi(C, 0, 2)));
    cursor.write(chord(f16, pi(G, 0, 1)));
    cursor.write(chord(f16, pi(C, 0, 2)));
    cursor.write(lastSlurC = chord(f16, pi(G, 0, 1)));
    cursor.closeBeam();
    firstSlurB = new BezierPoint(sp(-is, is * 8.5f), sp(15, 4));
    lastSlurB = new BezierPoint(sp(0, is * 7.5f), sp(-is * 5, is * 2));
    new SlurAdd(new Slur(SlurType.Slur, clwp(firstSlurC, firstSlurB), clwp(lastSlurC, lastSlurB), null)).execute();
    // measure 5
    cursor.write(chord(f4, staccato, pi(B, 0, 1)));
    cursor.write(new Rest(f4));
    cursor.write(new Rest(f2));
    // end line
    Barline barlineEnd = Barline.barline(BarlineStyle.LightHeavy);
    new ColumnElementWrite(barlineEnd, score.getColumnHeader(4), null, MeasureSide.Right).execute();
    return score;
}
Also used : BracketGroupAdd(com.xenoage.zong.commands.core.music.group.BracketGroupAdd) Dynamic(com.xenoage.zong.core.music.direction.Dynamic) StaffLayout(com.xenoage.zong.core.format.StaffLayout) ColumnElementWrite(com.xenoage.zong.commands.core.music.ColumnElementWrite) Clef(com.xenoage.zong.core.music.clef.Clef) TraditionalKey(com.xenoage.zong.core.music.key.TraditionalKey) Cursor(com.xenoage.zong.io.selection.Cursor) StavesRange(com.xenoage.zong.core.music.group.StavesRange) Rest(com.xenoage.zong.core.music.rest.Rest) DirectionAdd(com.xenoage.zong.commands.core.music.direction.DirectionAdd) Chord(com.xenoage.zong.core.music.chord.Chord) BarlineGroup(com.xenoage.zong.core.music.group.BarlineGroup) BarlineGroupAdd(com.xenoage.zong.commands.core.music.group.BarlineGroupAdd) BracketGroup(com.xenoage.zong.core.music.group.BracketGroup) Position(com.xenoage.zong.core.music.format.Position) Fraction(com.xenoage.utils.math.Fraction) Wedge(com.xenoage.zong.core.music.direction.Wedge) ArticulationType(com.xenoage.zong.core.music.annotation.ArticulationType) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature) BezierPoint(com.xenoage.zong.core.music.format.BezierPoint) Slur(com.xenoage.zong.core.music.slur.Slur) Score(com.xenoage.zong.core.Score) Tempo(com.xenoage.zong.core.music.direction.Tempo) Part(com.xenoage.zong.core.music.Part) Instrument(com.xenoage.zong.core.instrument.Instrument) PartAdd(com.xenoage.zong.commands.core.music.PartAdd) SlurAdd(com.xenoage.zong.commands.core.music.slur.SlurAdd) Barline(com.xenoage.zong.core.music.barline.Barline)

Aggregations

TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)17 Clef (com.xenoage.zong.core.music.clef.Clef)8 Score (com.xenoage.zong.core.Score)7 Key (com.xenoage.zong.core.music.key.Key)6 TimeSignature (com.xenoage.zong.core.music.time.TimeSignature)5 Test (org.junit.Test)5 Fraction (com.xenoage.utils.math.Fraction)4 Rest (com.xenoage.zong.core.music.rest.Rest)4 Part (com.xenoage.zong.core.music.Part)3 Chord (com.xenoage.zong.core.music.chord.Chord)3 Dynamic (com.xenoage.zong.core.music.direction.Dynamic)3 Cursor (com.xenoage.zong.io.selection.Cursor)3 ColumnElementWrite (com.xenoage.zong.commands.core.music.ColumnElementWrite)2 PartAdd (com.xenoage.zong.commands.core.music.PartAdd)2 ColumnHeader (com.xenoage.zong.core.header.ColumnHeader)2 Instrument (com.xenoage.zong.core.instrument.Instrument)2 StavesRange (com.xenoage.zong.core.music.group.StavesRange)2 MxlAttributes (com.xenoage.zong.musicxml.types.MxlAttributes)2 MxlKey (com.xenoage.zong.musicxml.types.MxlKey)2 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)2