Search in sources :

Example 21 with Note

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

the class MultiplyProcessor method processNotes.

@Override
public final void processNotes(NoteList in) throws NoteProcessorException {
    Note temp;
    double fieldVal = 0;
    for (int i = 0; i < in.size(); i++) {
        temp = in.get(i);
        try {
            fieldVal = Double.parseDouble(temp.getPField(pfield));
        } catch (NumberFormatException ex) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.pfieldNotDouble"), pfield);
        } catch (Exception ex) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.missingPfield"), pfield);
        }
        temp.setPField(Double.toString(fieldVal * value), pfield);
    }
}
Also used : Note(blue.soundObject.Note) NoteParseException(blue.soundObject.NoteParseException)

Example 22 with Note

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

the class RotateProcessor method processNotes.

@Override
public final void processNotes(NoteList in) throws NoteProcessorException {
    if (in.size() < 2 || noteIndex == 1) {
        return;
    }
    in.sort();
    Note lastNote = in.get(in.size() - 1);
    double startTime = lastNote.getStartTime() + lastNote.getSubjectiveDuration();
    int index = noteIndex;
    if (index > 0) {
        index = index - 1;
    } else {
        index = in.size() + index;
    }
    if (index > in.size()) {
        throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.rotateIndex"));
    }
    Collections.rotate(in, -index);
    index = in.size() - index;
    while (index < in.size()) {
        Note n = in.get(index);
        n.setStartTime(n.getStartTime() + startTime);
        index++;
    }
    ScoreUtilities.normalizeNoteList(in);
}
Also used : Note(blue.soundObject.Note)

Example 23 with Note

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

the class SwitchProcessor method processNotes.

@Override
public final void processNotes(NoteList in) throws NoteProcessorException {
    Note temp;
    String tempPField;
    int pcount = 0;
    for (int i = 0; i < in.size(); i++) {
        temp = in.get(i);
        // validate necessary pfields are there
        pcount = temp.getPCount();
        if (pfield1 < 1 || pfield1 >= pcount) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.missingPfield"), pfield1);
        }
        if (pfield2 < 1 || pfield2 >= pcount) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.missingPfield"), pfield2);
        }
        tempPField = temp.getPField(pfield1);
        temp.setPField(temp.getPField(pfield2), pfield1);
        temp.setPField(tempPField, pfield2);
    }
}
Also used : Note(blue.soundObject.Note)

Example 24 with Note

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

the class TuningProcessor method processNotes.

@Override
public void processNotes(NoteList in) throws NoteProcessorException {
    Note temp;
    int pcount = 0;
    double freq = 0f;
    for (int i = 0; i < in.size(); i++) {
        temp = in.get(i);
        // verify pfield
        pcount = temp.getPCount();
        if (pfield < 1 || pfield > pcount) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.missingPfield"), pfield);
        }
        String val = temp.getPField(pfield).trim();
        try {
            freq = convert(val, scale);
        } catch (Exception ex) {
            throw new NoteProcessorException(this, BlueSystem.getString("noteProcessorException.scaleFileConvert"), pfield);
        }
        temp.setPField(Double.toString(freq), pfield);
    }
}
Also used : Note(blue.soundObject.Note) NoteParseException(blue.soundObject.NoteParseException)

Example 25 with Note

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

the class Field method generateNotes.

public NoteList generateNotes(final double duration, java.util.Random rnd) {
    NoteList nl = new NoteList();
    double xt = 0.0;
    int numFields = parameters.size();
    for (int i = 0; i < parameters.size(); i++) {
        getParameter(i).initialize(duration);
    }
    while (xt < duration) {
        Note n = Note.createNote(numFields);
        double p1 = getParameter(0).getValue(xt, rnd);
        p1 = p1 < 1.0 ? 1.0 : Utilities.round(p1, 0);
        n.setPField(NumberUtilities.formatDouble(p1), 1);
        n.setPField(NumberUtilities.formatDouble(xt), 2);
        for (int i = 3; i < numFields + 1; i++) {
            double val = getParameter(i - 1).getValue(xt, rnd);
            if (i == 3 && val < 0) {
                n.setPField(NumberUtilities.formatDouble(-val), i);
                n.setTied(true);
            } else {
                n.setPField(NumberUtilities.formatDouble(val), i);
            }
        }
        double p2 = getParameter(1).getValue(xt, rnd);
        if (p2 == 0.0) {
            System.err.println("[JMask] - WARNING: p2 = 0 !");
        }
        xt += p2;
        nl.add(n);
    }
    return nl;
}
Also used : NoteList(blue.soundObject.NoteList) Note(blue.soundObject.Note)

Aggregations

Note (blue.soundObject.Note)30 NoteParseException (blue.soundObject.NoteParseException)14 NoteList (blue.soundObject.NoteList)11 Iterator (java.util.Iterator)2 Random (java.util.Random)2 Arrangement (blue.Arrangement)1 CompileData (blue.CompileData)1 GlobalOrcSco (blue.GlobalOrcSco)1 Tables (blue.Tables)1 ParameterNameManager (blue.automation.ParameterNameManager)1 LinePoint (blue.components.lines.LinePoint)1 Mixer (blue.mixer.Mixer)1 TempoMapper (blue.noteProcessor.TempoMapper)1 GenericInstrument (blue.orchestra.GenericInstrument)1 Instrument (blue.orchestra.Instrument)1 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)1 StringChannelNameManager (blue.orchestra.blueSynthBuilder.StringChannelNameManager)1 ScoreGenerationException (blue.score.ScoreGenerationException)1 ScoreObject (blue.score.ScoreObject)1 Tempo (blue.score.tempo.Tempo)1