Search in sources :

Example 31 with NoteList

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

the class ScoreUtilitiesTest method testScoreCarry.

public void testScoreCarry() {
    String testScore = "i1 0 2 3 4 5\n" + "i1.1 0 .\n" + "i1 0 .";
    NoteList nl = null;
    try {
        nl = ScoreUtilities.getNotes(testScore);
    } catch (NoteParseException ex) {
        ex.printStackTrace();
    }
    assertNotNull(nl);
    assertEquals(3, nl.size());
    assertEquals(6, nl.get(1).getPCount());
    assertEquals(6, nl.get(2).getPCount());
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException)

Example 32 with NoteList

use of blue.soundObject.NoteList 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 33 with NoteList

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

the class FieldTest method testGenerateNotesConstant.

/**
 * Test of loadFromXML method, of class blue.soundObject.jmask.Field.
 */
// public void testLoadFromXML() throws Exception {
// System.out.println("loadFromXML");
// 
// Element data = null;
// 
// Field expResult = null;
// Field result = Field.loadFromXML(data);
// assertEquals(expResult, result);
// 
// // TODO review the generated test code and remove the default call to
// fail.
// fail("The test case is a prototype.");
// }
// 
/**
 * Test of saveAsXML method, of class blue.soundObject.jmask.Field.
 */
// public void testSaveAsXML() {
// System.out.println("saveAsXML");
// 
// Field instance = new Field();
// 
// Element expResult = null;
// Element result = instance.saveAsXML();
// assertEquals(expResult, result);
// 
// // TODO review the generated test code and remove the default call to
// fail.
// fail("The test case is a prototype.");
// }
/**
 * Test of generateNotes method, of class blue.soundObject.jmask.Field.
 */
public void testGenerateNotesConstant() {
    double duration = 5.0;
    Field field = new Field();
    java.util.Random r = new java.util.Random(0L);
    NoteList result = field.generateNotes(duration, r);
    assertEquals(5, result.size());
    Constant c = (Constant) field.getParameter(0).getGenerator();
    c.setValue(2.0);
    result = field.generateNotes(duration, r);
    for (int i = 0; i < result.size(); i++) {
        assertEquals("2", result.get(i).getPField(1));
    }
    Constant c2 = (Constant) field.getParameter(1).getGenerator();
    c2.setValue(1.5);
    result = field.generateNotes(duration, new java.util.Random(0L));
    assertEquals(4, result.size());
}
Also used : NoteList(blue.soundObject.NoteList)

Example 34 with NoteList

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

the class Score method generateForCSD.

public NoteList generateForCSD(CompileData compileData, double startTime, double endTime) throws ScoreGenerationException {
    NoteList noteList = new NoteList();
    boolean soloFound = false;
    for (LayerGroup layerGroup : this) {
        soloFound = layerGroup.hasSoloLayers();
        if (soloFound) {
            break;
        }
    }
    for (LayerGroup layerGroup : this) {
        NoteList nl = layerGroup.generateForCSD(compileData, startTime, endTime, soloFound);
        noteList.merge(nl);
    }
    try {
        ScoreUtilities.applyNoteProcessorChain(noteList, this.npc);
    } catch (NoteProcessorException e) {
        throw new ScoreGenerationException(e);
    }
    return noteList;
}
Also used : NoteProcessorException(blue.noteProcessor.NoteProcessorException) NoteList(blue.soundObject.NoteList) LayerGroup(blue.score.layers.LayerGroup)

Example 35 with NoteList

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

the class PolyObjectEditor method testSoundObject.

public final void testSoundObject() {
    if (this.pObj == null) {
        return;
    }
    BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
    if (data == null) {
        System.err.println("PolyObjectEditor::testSoundObject() - " + "Could not get reference to current BlueData object");
        return;
    }
    Tables tables = new Tables(data.getTableSet());
    Arrangement arrangement = new Arrangement(data.getArrangement());
    PolyObject tempPObj = new PolyObject(this.pObj);
    OpcodeList opcodeList = new OpcodeList(data.getOpcodeList());
    GlobalOrcSco globalOrcSco = new GlobalOrcSco(data.getGlobalOrcSco());
    // adding all compile-time instruments from soundObjects to arrangement
    arrangement.generateFTables(tables);
    CompileData compileData = new CompileData(arrangement, tables);
    // grabbing all notes from soundObjects
    NoteList generatedNotes = null;
    try {
        generatedNotes = tempPObj.generateForCSD(compileData, 0.0f, -1.0f);
    } catch (Exception e) {
        Exceptions.printStackTrace(e);
        return;
    }
    if (generatedNotes != null) {
        InfoDialog.showInformationDialog(SwingUtilities.getRoot(this), generatedNotes.toString(), BlueSystem.getString("soundObject.generatedScore"));
    }
}
Also used : BlueData(blue.BlueData) GlobalOrcSco(blue.GlobalOrcSco) NoteList(blue.soundObject.NoteList) OpcodeList(blue.udo.OpcodeList) Tables(blue.Tables) Arrangement(blue.Arrangement) PolyObject(blue.soundObject.PolyObject) CompileData(blue.CompileData)

Aggregations

NoteList (blue.soundObject.NoteList)50 NoteParseException (blue.soundObject.NoteParseException)25 Note (blue.soundObject.Note)11 CompileData (blue.CompileData)6 SoundObject (blue.soundObject.SoundObject)6 GenericScore (blue.soundObject.GenericScore)4 Arrangement (blue.Arrangement)3 GlobalOrcSco (blue.GlobalOrcSco)3 Tables (blue.Tables)3 NoteProcessorException (blue.noteProcessor.NoteProcessorException)3 SoundObjectException (blue.soundObject.SoundObjectException)3 OpcodeList (blue.udo.OpcodeList)3 ParameterNameManager (blue.automation.ParameterNameManager)2 LiveObject (blue.blueLive.LiveObject)2 LiveObjectSet (blue.blueLive.LiveObjectSet)2 LinePoint (blue.components.lines.LinePoint)2 Mixer (blue.mixer.Mixer)2 TempoMapper (blue.noteProcessor.TempoMapper)2 GenericInstrument (blue.orchestra.GenericInstrument)2 Instrument (blue.orchestra.Instrument)2