Package com.music

Examples of com.music.MainPartGenerator


                new Note(JMC.E5, JMC.EIGHTH_NOTE), new Note(JMC.EF5, JMC.EIGHTH_NOTE),
                new Note(JMC.E5, JMC.EIGHTH_NOTE), new Note(JMC.B4, JMC.EIGHTH_NOTE),
                new Note(JMC.D5, JMC.EIGHTH_NOTE), new Note(JMC.C5, JMC.EIGHTH_NOTE),
                new Note(JMC.A4, JMC.EIGHTH_NOTE) };

        MainPartGenerator generator = new MainPartGenerator();
        Score score = new Score();
        Part mainPart = new Part("Main", 1);
        score.addPart(mainPart);
        ScoreContext ctx = new ScoreContext();
        ctx.setMetre(new int[] {3, 8});
        ctx.setScale(Scale.MINOR);
        ctx.setKeyNote(5);
        ctx.setNoteLengthCoefficient(1);
        double normalizedMeasureSize = 1d * ctx.getMetre()[0] * 4 / ctx.getMetre()[1];
        ctx.setNormalizedMeasureSize(normalizedMeasureSize);
        MainPartContext lCtx = generator.initLocalContext(score, ctx);
        lCtx.setPitches(Arrays.asList(60, 80, 80));
        ExtendedPhrase p = new ExtendedPhrase();
        p.setBaseVelocity(40);
        p.setScale(ctx.getScale());
        mainPart.add(p);
        lCtx.setCurrentPhrase(p);
        for (Note note : melody) {
            p.addNote(note);
        }
        List<Note> modified = new ArrayList<>(Arrays.asList(melody));
        generator.varyBaseStructure(lCtx, modified);
        System.out.println(modified);
        for (Note note : modified) {
            p.addNote(note);
        }

View Full Code Here

TOP

Related Classes of com.music.MainPartGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.