Skip to content

Commit

Permalink
command line, parameterizable generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Glamdring committed Jan 8, 2018
1 parent 00e1dae commit d541736
Show file tree
Hide file tree
Showing 20 changed files with 792 additions and 663 deletions.
932 changes: 469 additions & 463 deletions pom.xml

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions src/main/java/com/music/AccompanimentPartGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
import java.util.List;
import java.util.Random;

import jm.constants.Instruments;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;
import jm.music.tools.Mod;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -43,18 +35,27 @@
import com.music.model.SpecialNoteType;
import com.music.model.ToneGroups;
import com.music.model.ToneType;
import com.music.model.prefs.UserPreferences;
import com.music.util.music.Chance;
import com.music.util.music.ChordUtils;
import com.music.util.music.NoteFactory;
import com.music.util.music.ToneResolver;

import jm.constants.Instruments;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;
import jm.music.tools.Mod;

public class AccompanimentPartGenerator implements ScoreManipulator {
private static final Logger logger = LoggerFactory.getLogger(AccompanimentPartGenerator.class);

private Random random = new Random();

@Override
public void handleScore(Score score, ScoreContext ctx) {
public void handleScore(Score score, ScoreContext ctx, UserPreferences prefs) {
Part accompanimentPart = ctx.getParts().get(PartType.ACCOMPANIMENT);
if (accompanimentPart == null) {
return;
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/com/music/Arpeggiator.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
import java.util.List;
import java.util.Random;

import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;

import org.apache.commons.lang3.ArrayUtils;

import com.music.model.Chord;
Expand All @@ -39,16 +33,23 @@
import com.music.model.SpecialNoteType;
import com.music.model.ToneGroups;
import com.music.model.ToneType;
import com.music.model.prefs.UserPreferences;
import com.music.util.music.Chance;
import com.music.util.music.ChordUtils;
import com.music.util.music.NoteFactory;
import com.music.util.music.ToneResolver;

import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;

public class Arpeggiator implements ScoreManipulator {
private Random random = new Random();

@Override
public void handleScore(Score score, ScoreContext ctx) {
public void handleScore(Score score, ScoreContext ctx, UserPreferences prefs) {
Part part = ctx.getParts().get(PartType.ARPEGGIO);
if (part == null) {
return;
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/music/BassPartGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,28 @@

import java.util.Random;

import jm.JMC;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;

import com.music.model.ExtendedPhrase;
import com.music.model.InstrumentGroups;
import com.music.model.PartType;
import com.music.model.Scale;
import com.music.model.SpecialNoteType;
import com.music.model.prefs.UserPreferences;
import com.music.util.music.Chance;
import com.music.util.music.NoteFactory;

import jm.JMC;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;

public class BassPartGenerator implements ScoreManipulator {

private static Random random = new Random();

@Override
public void handleScore(Score score, ScoreContext ctx) {
public void handleScore(Score score, ScoreContext ctx, UserPreferences prefs) {
Part bassPart = ctx.getParts().get(PartType.BASS);
if (bassPart == null) {
return;
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/com/music/DroneGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,25 @@
import java.util.List;
import java.util.Random;

import jm.constants.Pitches;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Score;

import com.music.model.ExtendedPhrase;
import com.music.model.InstrumentGroups;
import com.music.model.PartType;
import com.music.model.Scale;
import com.music.model.prefs.UserPreferences;
import com.music.util.music.Chance;
import com.music.util.music.NoteFactory;

import jm.constants.Pitches;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Score;

public class DroneGenerator implements ScoreManipulator {
private final Random random = new Random();

@Override
public void handleScore(Score score, ScoreContext ctx) {
public void handleScore(Score score, ScoreContext ctx, UserPreferences prefs) {
Part dronePart = ctx.getParts().get(PartType.DRONE);
if (dronePart == null) {
return;
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/music/EffectsGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@

import java.util.Random;

import com.music.model.PartType;
import com.music.model.prefs.UserPreferences;
import com.music.util.music.Chance;
import com.music.util.music.NoteFactory;

import jm.constants.Pitches;
import jm.music.data.Note;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Rest;
import jm.music.data.Score;

import com.music.model.PartType;
import com.music.util.music.Chance;
import com.music.util.music.NoteFactory;

public class EffectsGenerator implements ScoreManipulator {
private Random random = new Random();

@Override
public void handleScore(Score score, ScoreContext ctx) {
public void handleScore(Score score, ScoreContext ctx, UserPreferences prefs) {
Part effectsPart = ctx.getParts().get(PartType.EFFECTS);
if (effectsPart == null) {
return;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/music/GenerationOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.music;

public class GenerationOptions {
private int length;

}
Loading

0 comments on commit d541736

Please sign in to comment.