complete preliminary parsing logic
This commit is contained in:
+107
-42
@@ -35,40 +35,49 @@ function parse(binary) {
|
|||||||
// every eigth byte is padding, so we remove it
|
// every eigth byte is padding, so we remove it
|
||||||
const unpaddedBinary = trimmedBinary.filter((el, idx) => idx % 8);
|
const unpaddedBinary = trimmedBinary.filter((el, idx) => idx % 8);
|
||||||
|
|
||||||
const timbre = new Parser()
|
const paramStart = new Parser()
|
||||||
.uint8("midiChannel")
|
.uint8("midiChannel")
|
||||||
.bit2("assignMode")
|
.bit2("assignMode")
|
||||||
.bit1("eg2Reset")
|
.bit1("eg2Reset")
|
||||||
.bit1("eg1Reset")
|
.bit1("eg1Reset")
|
||||||
.bit1("triggerMode")
|
.bit1("triggerMode")
|
||||||
.bit2("keyPriority")
|
.bit2("keyPriority")
|
||||||
.uint8("unisonDetune")
|
.uint8("unisonDetune");
|
||||||
|
|
||||||
|
const pitch = new Parser()
|
||||||
.uint8("pitchTune")
|
.uint8("pitchTune")
|
||||||
.uint8("pitchBendRange")
|
.uint8("pitchBendRange")
|
||||||
.uint8("pitchTranspose")
|
.uint8("pitchTranspose")
|
||||||
.uint8("pitchVibratoInt")
|
.uint8("pitchVibratoInt");
|
||||||
|
|
||||||
|
const osc1 = new Parser()
|
||||||
.uint8("osc1Wave")
|
.uint8("osc1Wave")
|
||||||
.uint8("osc1WaveCtrl1")
|
.uint8("osc1WaveCtrl1")
|
||||||
.uint8("osc1WaveCtrl2")
|
.uint8("osc1WaveCtrl2")
|
||||||
.uint8("osc1DWGSWave")
|
.uint8("osc1DWGSWave");
|
||||||
.seek(1)
|
|
||||||
.bit2("ignore")
|
const osc2 = new Parser()
|
||||||
|
.bit2("ignore") // only timbres 1 and 2
|
||||||
.bit2("osc2ModSelect")
|
.bit2("osc2ModSelect")
|
||||||
.bit2("ignore")
|
.bit2("ignore")
|
||||||
.bit2("osc2Wave")
|
.bit2("osc2Wave")
|
||||||
.uint8("osc2Semitone")
|
.uint8("osc2Semitone")
|
||||||
.uint8("osc2Tune")
|
.uint8("osc2Tune");
|
||||||
.bit1("ignore")
|
|
||||||
.bit7("portamentoTime")
|
const mixer = new Parser()
|
||||||
.uint8("osc1Level")
|
.uint8("Level1")
|
||||||
.uint8("osc2Level")
|
.uint8("Level2")
|
||||||
.uint8("noiseLevel")
|
.uint8("noiseLevel");
|
||||||
|
|
||||||
|
const filter = new Parser()
|
||||||
.uint8("filterType")
|
.uint8("filterType")
|
||||||
.uint8("filterCutoff")
|
.uint8("filterCutoff")
|
||||||
.uint8("filterResonance")
|
.uint8("filterResonance")
|
||||||
.uint8("filterEG1Intensity")
|
.uint8("filterEG1Intensity")
|
||||||
.uint8("filterVelocitySense")
|
.uint8("filterVelocitySense")
|
||||||
.uint8("filterKeyboardTrack")
|
.uint8("filterKeyboardTrack");
|
||||||
|
|
||||||
|
const amp = new Parser()
|
||||||
.uint8("ampLevel")
|
.uint8("ampLevel")
|
||||||
.uint8("ampPanpot")
|
.uint8("ampPanpot")
|
||||||
.bit1("ignore")
|
.bit1("ignore")
|
||||||
@@ -76,34 +85,28 @@ function parse(binary) {
|
|||||||
.bit6("ignore")
|
.bit6("ignore")
|
||||||
.bit1("ampDistortion")
|
.bit1("ampDistortion")
|
||||||
.uint8("ampVelocitySense")
|
.uint8("ampVelocitySense")
|
||||||
.uint8("ampKeyboardTrack")
|
.uint8("ampKeyboardTrack");
|
||||||
.uint8("eg1Attack")
|
|
||||||
.uint8("eg1Decay")
|
const env = new Parser()
|
||||||
.uint8("eg1Sustain")
|
.uint8("egAttack")
|
||||||
.uint8("eg1Release")
|
.uint8("egDecay")
|
||||||
.uint8("eg2Attack")
|
.uint8("egSustain")
|
||||||
.uint8("eg2Decay")
|
.uint8("egRelease");
|
||||||
.uint8("eg2Sustain")
|
|
||||||
.uint8("eg2Release")
|
const lfo = new Parser()
|
||||||
.bit2("ignore")
|
.bit2("ignore")
|
||||||
.bit2("lfo1KeySync")
|
.bit2("lfoKeySync")
|
||||||
.bit2("ignore")
|
.bit2("ignore")
|
||||||
.bit2("lfo1Wave")
|
.bit2("lfoWave")
|
||||||
.uint8("lfo1Freq")
|
.uint8("lfoFreq")
|
||||||
.bit1("lfo1TempoSync")
|
.bit1("lfoTempoSync")
|
||||||
.bit2("ignore")
|
.bit2("ignore")
|
||||||
.bit5("lfo1SyncNote")
|
.bit5("lfoSyncNote");
|
||||||
.bit2("ignore")
|
|
||||||
.bit2("lfo2KeySync")
|
const patchMods = new Parser()
|
||||||
.bit2("ignore")
|
.bit4("patch1Dest") // Patch Begin // only timbres and and 2
|
||||||
.bit2("lfo2Wave")
|
|
||||||
.uint8("lfo2Freq")
|
|
||||||
.bit1("lfo2TempoSync")
|
|
||||||
.bit2("ignore")
|
|
||||||
.bit5("lfo2SyncNote")
|
|
||||||
.bit4("patch1Dest")
|
|
||||||
.bit4("patch1Src")
|
.bit4("patch1Src")
|
||||||
.uint8("patch1Intensity")
|
.uint8("patch1Intensity") // Patch End
|
||||||
.bit4("patch2Dest")
|
.bit4("patch2Dest")
|
||||||
.bit4("patch2Src")
|
.bit4("patch2Src")
|
||||||
.uint8("patch2Intensity")
|
.uint8("patch2Intensity")
|
||||||
@@ -112,7 +115,69 @@ function parse(binary) {
|
|||||||
.uint8("patch3Intensity")
|
.uint8("patch3Intensity")
|
||||||
.bit4("patch4Dest")
|
.bit4("patch4Dest")
|
||||||
.bit4("patch4Src")
|
.bit4("patch4Src")
|
||||||
.uint8("patch4Intensity");
|
.uint8("patch4Intensity")
|
||||||
|
.seek(56);
|
||||||
|
|
||||||
|
const timbre = new Parser()
|
||||||
|
.nest({ type: paramStart })
|
||||||
|
.nest({ type: pitch })
|
||||||
|
.nest({ type: osc1 })
|
||||||
|
.seek(1)
|
||||||
|
.nest({ type: osc2 })
|
||||||
|
.bit1("ignore")
|
||||||
|
.bit7("portamentoTime")
|
||||||
|
.nest({ type: mixer })
|
||||||
|
.nest({ type: filter })
|
||||||
|
.nest({ type: amp })
|
||||||
|
.nest("eg1", { type: env })
|
||||||
|
.nest("eg2", { type: env })
|
||||||
|
.nest("lfo1", { type: lfo })
|
||||||
|
.nest("lfo2", { type: lfo })
|
||||||
|
.nest({ type: patchMods });
|
||||||
|
|
||||||
|
const vocoder = new Parser()
|
||||||
|
.nest({ type: paramStart })
|
||||||
|
.nest({ type: pitch })
|
||||||
|
.nest({ type: osc1 })
|
||||||
|
.seek(1)
|
||||||
|
.bit7("ignore")
|
||||||
|
.bit1("hpfGate")
|
||||||
|
.seek(1)
|
||||||
|
.bit1("ignore")
|
||||||
|
.bit7("portamentoTime")
|
||||||
|
.nest({ type: mixer })
|
||||||
|
.uint8("hpfLevel")
|
||||||
|
.uint8("gateSense")
|
||||||
|
.uint8("threshold")
|
||||||
|
.uint8("filterShift")
|
||||||
|
.uint8("filterCutoff")
|
||||||
|
.uint8("filterResonance")
|
||||||
|
.uint8("filterModSource")
|
||||||
|
.uint8("filterIntensity")
|
||||||
|
.uint8("filterEFSense")
|
||||||
|
.uint8("ampLevel")
|
||||||
|
.uint8("ampDirectLevel")
|
||||||
|
.bit7("ignore")
|
||||||
|
.b1("ampDistortion")
|
||||||
|
.uint8("ampVelocitySense")
|
||||||
|
.uint8("ampKeyTrack")
|
||||||
|
.nest("eg1", { type: env })
|
||||||
|
.nest("eg2", { type: env })
|
||||||
|
.nest("lfo1", { type: lfo })
|
||||||
|
.nest("lfo2", { type: lfo })
|
||||||
|
.array("level", {
|
||||||
|
type: "uint8",
|
||||||
|
lengthInBytes: 16,
|
||||||
|
})
|
||||||
|
.array("pan", {
|
||||||
|
type: "uint8",
|
||||||
|
lengthInBytes: 16,
|
||||||
|
})
|
||||||
|
.array("efHoldLevel", {
|
||||||
|
type: "uint8",
|
||||||
|
lengthInBytes: 16,
|
||||||
|
});
|
||||||
|
//end stuff
|
||||||
|
|
||||||
const parser = new Parser()
|
const parser = new Parser()
|
||||||
.endianness("big")
|
.endianness("big")
|
||||||
@@ -154,9 +219,10 @@ function parse(binary) {
|
|||||||
.uint8("arpSwing")
|
.uint8("arpSwing")
|
||||||
.uint8("kbdOctave")
|
.uint8("kbdOctave")
|
||||||
.nest("timbre1", { type: timbre })
|
.nest("timbre1", { type: timbre })
|
||||||
.seek(56)
|
|
||||||
.nest("timbre2", { type: timbre })
|
.nest("timbre2", { type: timbre })
|
||||||
.seek(56);
|
.nest("vocoder", { type: vocoder });
|
||||||
|
|
||||||
|
parser.parse(trimmedBinary); // return a object with this
|
||||||
}
|
}
|
||||||
|
|
||||||
function PatchEditor() {
|
function PatchEditor() {
|
||||||
@@ -211,8 +277,7 @@ function App() {
|
|||||||
className="App-link"
|
className="App-link"
|
||||||
href="https://reactjs.org"
|
href="https://reactjs.org"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer">
|
||||||
>
|
|
||||||
Learn React
|
Learn React
|
||||||
</a>
|
</a>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
Reference in New Issue
Block a user