Search in sources :

Example 21 with NoteParseException

use of blue.soundObject.NoteParseException in project blue by kunstmusik.

the class ScoreUtilitiesTest method testNGenScore.

public void testNGenScore() {
    String testScore = ";I-block #1 (i1):\n" + "i1    0.000  0.010     0.000   100.000\n" + "i1    0.010  0.010     0.111   100.000\n" + "i1    0.020  0.010     0.222   100.000\n" + "i1    0.030  0.010     0.333   100.000\n" + "i1    0.040  0.010     0.444   100.000\n" + "i1    0.050  0.010     0.556   100.000\n" + "i1    0.060  0.010     0.667   100.000\n" + "i1    0.070  0.010     0.778   100.000\n" + "i1    0.080  0.010     0.889   100.000\n" + "i1    0.090  0.010     1.000   100.000\n" + "\n" + "e\n";
    NoteList nl = null;
    try {
        nl = ScoreUtilities.getNotes(testScore);
    } catch (NoteParseException ex) {
        ex.printStackTrace();
    }
    assertNotNull(nl);
    assertEquals(10, nl.size());
    assertEquals(5, nl.get(0).getPCount());
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException)

Example 22 with NoteParseException

use of blue.soundObject.NoteParseException in project blue by kunstmusik.

the class ClojureObject method generateNotes.

protected final NoteList generateNotes(double renderStart, double renderEnd) throws SoundObjectException {
    String tempScore = null;
    File currentDirFile = BlueSystem.getCurrentProjectDirectory();
    HashMap<String, Object> initObjects = new HashMap<>();
    initObjects.put("score", "");
    initObjects.put("blueDuration", getSubjectiveDuration());
    initObjects.put("blueProjectDir", currentDirFile);
    try {
        tempScore = BlueClojureEngine.getInstance().processScript(clojureCode, initObjects, "score");
    } catch (ScriptException scriptEx) {
        String msg = "Clojure Error:\n" + getRootCauseException(scriptEx).toString();
        throw new SoundObjectException(this, msg);
    }
    NoteList nl;
    try {
        nl = ScoreUtilities.getNotes(tempScore);
    } catch (NoteParseException e) {
        throw new SoundObjectException(this, e);
    }
    try {
        ScoreUtilities.applyNoteProcessorChain(nl, this.npc);
    } catch (NoteProcessorException e) {
        throw new SoundObjectException(this, e);
    }
    ScoreUtilities.applyTimeBehavior(nl, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint());
    ScoreUtilities.setScoreStart(nl, startTime);
    return nl;
}
Also used : ScriptException(javax.script.ScriptException) NoteProcessorException(blue.noteProcessor.NoteProcessorException) NoteList(blue.soundObject.NoteList) HashMap(java.util.HashMap) NoteParseException(blue.soundObject.NoteParseException) SoundObject(blue.soundObject.SoundObject) AbstractSoundObject(blue.soundObject.AbstractSoundObject) SoundObjectException(blue.soundObject.SoundObjectException) File(java.io.File)

Example 23 with NoteParseException

use of blue.soundObject.NoteParseException in project blue by kunstmusik.

the class EqualsProcessor method main.

public static void main(String[] args) {
    NoteList n = new NoteList();
    for (int i = 0; i < 10; i++) {
        try {
            n.add(Note.createNote("i1 " + (i * 2) + " 2 3 4"));
        } catch (NoteParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    System.out.println("before: \n\n" + n + "\n\n");
    EqualsProcessor ep = new EqualsProcessor();
    ep.setPfield("4");
    ep.setVal("17");
    try {
        ep.processNotes(n);
    } catch (NoteProcessorException ex) {
        System.out.println("Error: " + ex.getMessage());
    }
    System.out.println("a after: \n\n" + n + "\n\n");
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException)

Example 24 with NoteParseException

use of blue.soundObject.NoteParseException in project blue by kunstmusik.

the class PchInversionProcessor method main.

public static void main(String[] args) {
    NoteList n = new NoteList();
    for (int i = 0; i < 10; i++) {
        try {
            n.add(Note.createNote("i1 " + i + " 2 6.0" + i + " 4"));
        } catch (NoteParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    System.out.println("before: \n\n" + n + "\n\n");
    PchInversionProcessor ap = new PchInversionProcessor();
    ap.setPfield("4");
    ap.setVal("5.00");
    try {
        ap.processNotes(n);
    } catch (NoteProcessorException ex) {
        System.out.println("Exception: " + ex.getMessage());
    }
    System.out.println("after: \n\n" + n + "\n\n");
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException)

Example 25 with NoteParseException

use of blue.soundObject.NoteParseException in project blue by kunstmusik.

the class RetrogradeProcessor method main.

public static void main(String[] args) {
    NoteList n = new NoteList();
    for (int i = 0; i < 10; i++) {
        try {
            n.add(Note.createNote("i1 " + i + " " + i + " 6." + i + " 4"));
        } catch (NoteParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    System.out.println("before: \n\n" + n + "\n\n");
    RetrogradeProcessor retro = new RetrogradeProcessor();
    retro.processNotes(n);
    System.out.println("after: \n\n" + n + "\n\n");
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException)

Aggregations

NoteParseException (blue.soundObject.NoteParseException)28 NoteList (blue.soundObject.NoteList)24 LinePoint (blue.components.lines.LinePoint)3 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)3 Note (blue.soundObject.Note)3 SoundObjectException (blue.soundObject.SoundObjectException)3 StrBuilder (org.apache.commons.lang3.text.StrBuilder)3 Parameter (blue.automation.Parameter)2 GenericInstrument (blue.orchestra.GenericInstrument)2 File (java.io.File)2 Arrangement (blue.Arrangement)1 BlueData (blue.BlueData)1 CompileData (blue.CompileData)1 GlobalOrcSco (blue.GlobalOrcSco)1 Tables (blue.Tables)1 ParameterNameManager (blue.automation.ParameterNameManager)1 Mixer (blue.mixer.Mixer)1 NoteProcessorException (blue.noteProcessor.NoteProcessorException)1 TempoMapper (blue.noteProcessor.TempoMapper)1 Instrument (blue.orchestra.Instrument)1