Search in sources :

Example 11 with NoteParseException

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

the class LineAddProcessor 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 + " 1 3 4"));
        } catch (NoteParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    System.out.println("before: \n\n" + n + "\n\n");
    LineAddProcessor lap = new LineAddProcessor();
    lap.setLineAddString("0 0 3 -3 6 0");
    try {
        lap.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 12 with NoteParseException

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

the class MultiplyProcessor 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");
    MultiplyProcessor mp = new MultiplyProcessor();
    mp.setPfield("2");
    mp.setVal("2.2f");
    try {
        mp.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 13 with NoteParseException

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

the class ImportMidiAction method importMidiFile.

public void importMidiFile() {
    final Frame mainWindow = WindowManager.getDefault().getMainWindow();
    List<File> rValue = FileChooserManager.getDefault().showOpenDialog(this.getClass(), mainWindow);
    if (rValue.size() == 0) {
        StatusDisplayer.getDefault().setStatusText(BlueSystem.getString("message.actionCancelled"));
        return;
    }
    File midiFile = rValue.get(0);
    BlueData tempData = new BlueData();
    try {
        PolyObject pObj = MidiImportUtilities.convertMidiFile(mainWindow, midiFile);
        if (pObj == null) {
            JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
            return;
        }
        tempData.getScore().clear();
        tempData.getScore().add(pObj);
    } catch (NoteParseException e) {
        JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    BlueProject project = new BlueProject(tempData, null);
    BlueProjectManager.getInstance().setCurrentProject(project);
}
Also used : BlueData(blue.BlueData) Frame(java.awt.Frame) NoteParseException(blue.soundObject.NoteParseException) BlueProject(blue.projects.BlueProject) File(java.io.File) PolyObject(blue.soundObject.PolyObject)

Example 14 with NoteParseException

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

the class CybilNoteList method createDefaultNote.

public Note createDefaultNote() {
    Note retVal = null;
    // Lazy initialization and caching
    if (defaultNote == null) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("i");
        buffer.append(instrumentId);
        for (int i = 0; i < numPfields - 1; i++) {
            buffer.append(" 0");
        }
        try {
            defaultNote = Note.createNote(buffer.toString());
        } catch (NoteParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    // System.err.println("Default Note: " + defaultNote.toString());
    // System.err.println("Num Pfields: " + numPfields);
    }
    retVal = new Note(defaultNote);
    return retVal;
}
Also used : NoteParseException(blue.soundObject.NoteParseException) Note(blue.soundObject.Note)

Example 15 with NoteParseException

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

the class CSDRender method getGlobalDuration.

/**
 * @param globalSco
 * @return
 * @throws SoundObjectException
 */
private double getGlobalDuration(String globalSco) throws SoundObjectException {
    NoteList globalNotes;
    try {
        globalNotes = ScoreUtilities.getNotes(globalSco);
    } catch (NoteParseException e) {
        GenericScore gs = new GenericScore();
        gs.setName("Global Orchestra Text");
        throw new SoundObjectException(gs, e);
    }
    double globalDur = ScoreUtilities.getTotalDuration(globalNotes);
    return globalDur;
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException) GenericScore(blue.soundObject.GenericScore) SoundObjectException(blue.soundObject.SoundObjectException)

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