use of blue.orchestra.blueX7.Operator in project blue by kunstmusik.
the class BlueX7 method loadFromXML.
public static Instrument loadFromXML(Element data) throws Exception {
BlueX7 instr = new BlueX7();
InstrumentUtilities.initBasicFromXML(data, instr);
instr.algorithmCommon = AlgorithmCommonData.loadFromXML(data.getElement("algorithmCommonData"));
instr.lfo = LFOData.loadFromXML(data.getElement("lfoData"));
Elements ops = data.getElements("operator");
int counter = 0;
while (ops.hasMoreElements()) {
instr.operators[counter] = Operator.loadFromXML(ops.next());
counter++;
}
Elements pegPoints = data.getElements("envelopePoint");
counter = 0;
while (pegPoints.hasMoreElements()) {
instr.peg[counter] = EnvelopePoint.loadFromXML(pegPoints.next());
counter++;
}
try {
instr.csoundPostCode = data.getTextString("csoundPostCode");
} catch (Exception e) {
}
return instr;
}
use of blue.orchestra.blueX7.Operator in project blue by kunstmusik.
the class BlueX7 method generateFTables.
@Override
public void generateFTables(Tables tables) {
StrBuilder buffer = new StrBuilder();
Object obj = tables.getCompilationVariable(BLUEX7_HAS_BEEN_COMPILED);
// static ftable generation)
if (obj == null || obj != Boolean.TRUE) {
tables.setCompilationVariable(BLUEX7_HAS_BEEN_COMPILED, Boolean.TRUE);
// assigning static table numbers
sineTable = tables.getOpenFTableNumber();
outputAmpTable = tables.getOpenFTableNumber();
rateScaleTable = tables.getOpenFTableNumber();
egRateRiseLvlTable = tables.getOpenFTableNumber();
egRateRisePercentageTable = tables.getOpenFTableNumber();
egRateDecayLvlTable = tables.getOpenFTableNumber();
egRateDecayPercentageTable = tables.getOpenFTableNumber();
egLevelPeakTable = tables.getOpenFTableNumber();
velAmpTable = tables.getOpenFTableNumber();
velSensitivityTable = tables.getOpenFTableNumber();
feedbackScaleTable = tables.getOpenFTableNumber();
buffer.append("; [BLUEX7] - START STATIC TABLES");
buffer.append("; sine wave\n");
buffer.append("f" + sineTable + " 0 512 10 1\n");
buffer.append("; operator output level to amp scale function (data from Chowning/Bristow)\n");
buffer.append("f" + outputAmpTable + " 0 128 7 0 10 .003 10 .013");
buffer.append(" 10 .031 10 .079 10 .188 10 .446");
buffer.append(" 5 .690 5 1.068 5 1.639 5 2.512");
buffer.append(" 5 3.894 5 6.029 5 9.263 4 13.119");
buffer.append(" 29 13.119\n");
buffer.append("; rate scaling function\n");
buffer.append("f" + rateScaleTable + " 0 128 7 0 128 1\n");
buffer.append("; eg rate rise function for lvl change between 0 and 99 (data from Opcode)\n");
buffer.append("f" + egRateRiseLvlTable + " 0 128 -7 38 5 22.8 5 12 5");
buffer.append(" 7.5 5 4.8 5 2.7 5 1.8 5 1.3");
buffer.append(" 8 .737 3 .615 3 .505 3 .409 3");
buffer.append(" .321 6 .080 6 .055 2 .032 3 .024");
buffer.append(" 3 .018 3 .014 3 .011 3 .008 3");
buffer.append(" .008 3 .007 3 .005 3 .003 32 .003\n");
buffer.append("; eg rate rise percentage function\n");
buffer.append("f" + egRateRisePercentageTable + " 0 128 -7 .00001 31 .00001 4 .02 5");
buffer.append(" .06 10 .14 10 .24 10 .35 10 .50");
buffer.append(" 10 .70 5 .86 4 1.0 29 1.0\n");
buffer.append("; eg rate decay function for lvl change between 0 and 99\n");
buffer.append("f" + egRateDecayLvlTable + " 0 128 -7 318 4 181 5 115 5");
buffer.append(" 63 5 39.7 5 20 5 11.2 5 7");
buffer.append(" 8 5.66 3 3.98 6 1.99 3 1.34 3");
buffer.append(" .99 3 .71 5 .41 3 .15 3 .081");
buffer.append(" 3 .068 3 .047 3 .037 3 .025 3");
buffer.append(" .02 3 .013 3 .008 36 .008\n");
buffer.append("; eg rate decay percentage function\n");
buffer.append("f" + egRateDecayPercentageTable + " 0 128 -7 .00001 10 .25 10 .35 10");
buffer.append(" .43 10 .52 10 .59 10 .70 10 .77");
buffer.append(" 10 .84 10 .92 9 1.0 29 1.0\n");
buffer.append("; eg level to peak deviation mapping function (index in radians = Index / 2PI)\n");
buffer.append("f" + egLevelPeakTable + " 0 128 -7 0 10 .000477 10 .002");
buffer.append(" 10 .00493 10 .01257 10 .02992 10 .07098");
buffer.append(" 5 .10981 5 .16997 5 .260855 5 .39979");
buffer.append(" 5 .61974 5 .95954 5 1.47425 4 2.08795");
buffer.append(" 29 2.08795\n");
buffer.append("; velocity to amp factor mapping function (rough guess)\n");
buffer.append("f" + velAmpTable + " 0 129 9 .25 1 0\n");
buffer.append("; velocity sensitivity scaling function\n");
buffer.append("f" + velSensitivityTable + " 0 8 -7 0 8 1\n");
buffer.append("; feedback scaling function\n");
buffer.append("f" + feedbackScaleTable + " 0 8 -7 0 8 7\n");
buffer.append("; [BLUEX7] - END STATIC TABLES\n\n");
}
// end static ftable generation
buffer.append("; FTABLES FOR BLUEX7 INSTRUMENT: " + this.getName() + "\n");
operatorTableNums = new int[6];
for (int i = 0; i < 6; i++) {
operatorTableNums[i] = tables.getOpenFTableNumber();
buffer.append(generateFTableForOperator(this.operators[i], operatorTableNums[i]) + "\n");
}
buffer.append("\n");
tables.setTables(tables.getTables() + "\n" + buffer.toString());
}
use of blue.orchestra.blueX7.Operator in project blue by kunstmusik.
the class BlueX7SysexReader method mapOperatorFromSingle.
public static final void mapOperatorFromSingle(BlueX7 blueX7, byte[] sysex, int operatorNum) {
Operator op = blueX7.operators[operatorNum];
int offset = START_OFFSET;
// get us to the operator we want
offset += (5 - operatorNum) * 21;
// reading envelope generator info - bytes 0 - 7
op.envelopePoints[0].x = sysex[offset++];
op.envelopePoints[1].x = sysex[offset++];
op.envelopePoints[2].x = sysex[offset++];
op.envelopePoints[3].x = sysex[offset++];
op.envelopePoints[0].y = sysex[offset++];
op.envelopePoints[1].y = sysex[offset++];
op.envelopePoints[2].y = sysex[offset++];
op.envelopePoints[3].y = sysex[offset++];
// bytes 8 - 10
op.breakpoint = sysex[offset++];
op.depthLeft = sysex[offset++];
op.depthRight = sysex[offset++];
// byte 11 - 12
op.curveLeft = sysex[offset++];
op.curveRight = sysex[offset++];
// byte 13 - 15
op.keyboardRateScaling = sysex[offset++];
op.modulationAmplitude = sysex[offset++];
op.velocitySensitivity = sysex[offset++];
// byte 16
op.outputLevel = sysex[offset++];
// byte 17 - 20
op.mode = sysex[offset++];
op.freqCoarse = sysex[offset++];
op.freqFine = sysex[offset++];
op.detune = sysex[offset++] - 7;
}
use of blue.orchestra.blueX7.Operator in project blue by kunstmusik.
the class BlueX7SysexReader method mapOperatorFromBank.
public static final void mapOperatorFromBank(BlueX7 blueX7, byte[] sysex, int patchNum, int operatorNum) {
Operator op = blueX7.operators[operatorNum];
int offset = START_OFFSET;
offset += patchNum * 128;
offset += (5 - operatorNum) * 17;
// reading envelope generator info - bytes 0 - 7
op.envelopePoints[0].x = sysex[offset++];
op.envelopePoints[1].x = sysex[offset++];
op.envelopePoints[2].x = sysex[offset++];
op.envelopePoints[3].x = sysex[offset++];
op.envelopePoints[0].y = sysex[offset++];
op.envelopePoints[1].y = sysex[offset++];
op.envelopePoints[2].y = sysex[offset++];
op.envelopePoints[3].y = sysex[offset++];
// bytes 8 - 10
op.breakpoint = sysex[offset++];
op.depthLeft = sysex[offset++];
op.depthRight = sysex[offset++];
// byte 11
int temp = sysex[offset++];
int val1 = temp & 3;
int val2 = (temp & 12) >>> 2;
op.curveLeft = val2;
op.curveRight = val1;
// byte 12
temp = sysex[offset++];
val1 = temp & 7;
val2 = (temp & 112) >>> 3;
op.keyboardRateScaling = val1;
op.detune = val2 - 7;
// System.out.println("detune: " + op.detune);
// byte 13
temp = sysex[offset++];
val1 = temp & 3;
val2 = (temp & 56) >>> 2;
op.modulationAmplitude = val1;
op.velocitySensitivity = val2;
// byte 14
op.outputLevel = sysex[offset++];
// byte 15
temp = sysex[offset++];
val1 = temp & 1;
val2 = (temp & 62) >>> 1;
op.mode = val1;
op.freqCoarse = val2;
// byte 16
op.freqFine = sysex[offset++];
}
Aggregations