Examples of Rest


Examples of jm.music.data.Rest

        pausePhrase.setTitle("Phrase " + lCtx.getPhrases().size());
        pausePhrase.setScale(lCtx.getCurrentScale());
        int measures = Chance.test(85) || lCtx.getScoreContext().getScore().getTempo() < 90 ? 1 : 2;
        pausePhrase.setMeasures(measures);
        for (int i = 0; i < measures; i ++) {
            pausePhrase.addRest(new Rest(lCtx.getNormalizedMeasureSize())); //TODO upbeat here as well?
        }
        lCtx.getPhrases().add(pausePhrase);
        lCtx.setTotalMeasures(lCtx.getTotalMeasures() + measures);

        lCtx.setUsePreviousMeasureLengths(false);
View Full Code Here

Examples of jm.music.data.Rest

        int erasedNotes = 1 + random.nextInt(3);
        int erasedCounter = 0;
        for (int i = 0; i < repeatedNotes.size(); i ++) {
            if (firstNotes || Chance.test(erasedNotes * 100 / repeatedNotes.size())) {
                Note removed = repeatedNotes.remove(i);
                repeatedNotes.add(i, new Rest(removed.getRhythmValue()));
                erasedCounter++;
            }
            if (erasedCounter >= erasedNotes) {
                break;
            }
View Full Code Here

Examples of jm.music.data.Rest

                    percussions = getRandomPercussionPattern();
                }
                // don't use the drums in some measures
                if (Chance.test(6)) {
                    Phrase phr = new Phrase(0.0);
                    phr.addRest(new Rest(ctx.getNormalizedMeasureSize()));
                    fullKit.add(phr);
                    continue;
                }

                for (int j = 0; j < percussions.length; j++) {
                    Phrase phr = new Phrase(0.0);
                    for (short k = 0; k < 16; k++) {
                        int[] chances = PRIMARY_DRUM_PERCENTAGES;
                        if (j % 2 == 1 || percussions[j] == 46) {
                            chances = SECONDARY_DRUM_PERCENTAGES;
                        }
                        if ((useMiddleBeats && k % 2 == 1 && Chance.test(6)) || Chance.test(chances[k / 2])) {
                            Note note = NoteFactory.createNote(percussions[j], beatNoteLength);
                            if (k % 2 == 1) {
                                note.setDynamic(35 + random.nextInt(8));
                            } else {
                                note.setDynamic(45 + random.nextInt(10));
                            }
                            phr.addNote(note);
                        } else {
                            phr.addRest(new Rest(beatNoteLength));
                        }
                    }
                    fullKit.add(phr);
                }
View Full Code Here

Examples of jm.music.data.Rest

                    if (Chance.test(85) && currentNotes != null) {
                        for (Note note : currentNotes) {
                            arpeggioPhrase.addNote(note);
                        }
                    } else {
                        arpeggioPhrase.addRest(new Rest(normalizedMeasureSize));
                    }
                } else if (currentMeasureSize == 0 && (currentNote.isRest() || lastMeasure)) {
                    arpeggioPhrase.addRest(new Rest(normalizedMeasureSize));
                }

                currentMeasureSize += currentNote.getRhythmValue();
                if (currentMeasureSize >= normalizedMeasureSize) {
                    currentMeasureSize = 0;
View Full Code Here

Examples of jm.music.data.Rest

    }


    private void handleEffects(ScoreContext ctx, Phrase phrase, int restPercentages) {
        if (Chance.test(restPercentages)) {
            phrase.addRest(new Rest(ctx.getNormalizedMeasureSize()));
        } else {
            int pitch = getRandomPitch(ctx);
            double effectLength = random.nextDouble() * ctx.getNormalizedMeasureSize();
            effectLength = Math.min(effectLength, ctx.getNormalizedMeasureSize());
            Note note = NoteFactory.createNote(pitch, effectLength);
            phrase.add(note);
            double lastRest = ctx.getNormalizedMeasureSize() - effectLength;
            if (lastRest > 0) {
                phrase.add(new Rest(lastRest));
            }
        }
    }
View Full Code Here

Examples of jm.music.data.Rest

            }
        } else {
            for (int i = 0; i < ctx.getMeasures(); i++) {
                Note note = NoteFactory.createNote(40 + random.nextInt(30), ctx.getNormalizedMeasureSize() / 4);
                phrase.add(note);
                phrase.add(new Rest(ctx.getNormalizedMeasureSize() - note.getRhythmValue()));
            }
        }

        drumPart.add(phrase);
View Full Code Here

Examples of jm.music.data.Rest

                        if (durationModifier > 0) {
                            note.setDuration(note.getRhythmValue() * durationModifier);
                        }
                        bassPhrase.addNote(note);
                    } else {
                        bassPhrase.addRest(new Rest(ctx.getNormalizedMeasureSize() / 2));
                    }
                }
            }
            bassPart.addPhrase(bassPhrase);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.