UNPKG

mercury-lang

Version:

Parser for the mercury live coding language

1,358 lines (1,357 loc) 19 kB
{ "parseTree": { "global": { "randomSeed": [ 9123 ], "highPass": [ 800, 5000 ], "lowPass": [ 5000, 100 ], "silence": false, "amp": [ 0.9, 5000 ], "tempo": [ 143 ], "scale": [ "minor_pentatonic", "d" ] }, "variables": { "bassLine": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3 ], "notes": [ 0, 2, 4, 7, 9, 9, 7, 4, 2, 0 ], "jnd": [ 17, 11, 20, 9, 0, 6, 12, 18, 3, 0, 1, 2 ] }, "objects": { "BQ53NFX4": { "object": "synth", "type": [ "sine", "saw" ], "functions": { "group": [ "sn", "bass" ], "time": [ "1/4", "1/8" ], "note": [ 7, 1 ], "env": [ 1, 300 ], "beat": [ 0.2 ], "amp": [ 0.7 ], "wave2": [ "saw", 0 ], "add_fx": [ [ "reverb", 0.9, 11 ], [ "lfo", "1/4", "up" ], [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "BQ53NFX4" ] } }, "XWCCW64I": { "object": "sample", "type": [ "kick_min", "snare_dub" ], "functions": { "group": [], "time": [ "1/16" ], "speed": [ 1 ], "env": [ 1, "1/32", 2 ], "beat": [ 0.9 ], "amp": [ 0.9 ], "stretch": [ 0, 1, 1 ], "add_fx": [ [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "XWCCW64I" ] } }, "aSynth": { "object": "synth", "type": "sine", "functions": { "group": [ "sn", "ld" ], "time": [ "1/16" ], "note": [ [ 0, 2, 4, 7, 9, 9, 7, 4, 2, 0 ], 1 ], "env": [ 1000, 200 ], "beat": [ 0.8 ], "amp": [ 0.5, 100 ], "wave2": [ "sine", 2 ], "add_fx": [ [ "drive", 16 ], [ "lfo", "1/4", "sine" ], [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "aSynth" ] } }, "bSynth": { "object": "synth", "type": "saw", "functions": { "group": [ "bass", "intro" ], "time": [ "1/16" ], "note": [ [ 7, 0, 0, 10 ], 2 ], "env": [ 300, 1000 ], "beat": [ 0.7 ], "amp": [ 0 ], "wave2": [ "saw", 0 ], "add_fx": [ [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "bSynth" ], "pan": [ "random" ] } }, "kck": { "object": "sample", "type": "kick_min", "functions": { "group": [], "time": [ "1/4" ], "speed": [ 1 ], "env": [ -1 ], "beat": [ 1 ], "amp": [ 0.9 ], "stretch": [ 0, 1, 1 ], "add_fx": [ [ "drive", 1.1 ], [ "filter", "low", 500, 0.3 ], [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "kck" ] } }, "myMidi": { "object": "midi", "type": "to Max 1", "functions": { "group": [], "time": [ "1/8" ], "note": [ 0, 0 ], "env": [ 150 ], "out": [ 2 ], "chord": "off", "sync": "off", "add_fx": [ [ 15, 100 ], [ 22, 60 ], [ "reverb", 1, 20 ], [ "chip", 0.5 ] ], "name": [ "myMidi" ] } } }, "groups": { "all": [ "aSynth", "bSynth", "kck", "myMidi" ] }, "print": [], "display": [], "comments": [ "// ring scl scale()" ] }, "syntaxTree": { "@main": [ { "@object": { "@set": { "@name": "volume", "@functions": [ { "@number": 0.9 }, { "@number": 5000 } ] } } }, { "@object": { "@set": { "@name": "tempo", "@functions": [ { "@number": 143 } ] } } }, { "@object": { "@set": { "@name": "randomSeed", "@functions": [ { "@number": 9123 } ] } } }, { "@object": { "@set": { "@name": "scale", "@functions": [ { "@identifier": "minor_pentatonic" }, { "@note": "d" } ] } } }, { "@object": { "@set": { "@name": "highPass", "@functions": [ { "@number": 800 }, { "@number": 5000 } ] } } }, { "@object": { "@set": { "@name": "lowPass", "@functions": [ { "@number": 5000 }, { "@number": 100 } ] } } }, { "@global": { "@comment": "// ring scl scale()" } }, { "@list": { "@name": "bassLine", "@params": { "@function": { "@name": "fill", "@args": [ { "@number": 0 }, { "@number": 16 }, { "@number": -3 }, { "@number": 16 } ] } } } }, { "@list": { "@name": "notes", "@params": { "@function": { "@name": "palin", "@args": [ { "@function": { "@name": "spread", "@args": [ { "@number": 5 }, { "@number": 0 }, { "@number": 12 } ] } } ] } } } }, { "@list": { "@name": "jnd", "@params": { "@function": { "@name": "join", "@args": [ { "@function": { "@name": "random", "@args": [ { "@number": 4 }, { "@number": 0 }, { "@number": 24 } ] } }, { "@function": { "@name": "spread", "@args": [ { "@number": 4 }, { "@number": 0 }, { "@number": 24 } ] } }, { "@function": { "@name": "urn", "@args": [ { "@number": 4 }, { "@number": 4 } ] } } ] } } } }, { "@object": { "@new": { "@inst": "synth", "@type": { "@array": [ { "@identifier": "sine" }, { "@identifier": "saw" } ] }, "@functions": [ { "@function": { "@name": "time", "@args": [ { "@division": "1/4" }, { "@division": "1/8" } ] } }, { "@function": { "@name": "note", "@args": [ { "@number": 7 }, { "@number": 1 } ] } }, { "@function": { "@name": "env", "@args": [ { "@number": 1 }, { "@number": 300 } ] } }, { "@function": { "@name": "beat", "@args": [ { "@number": 0.2 } ] } }, { "@function": { "@name": "group", "@args": [ { "@identifier": "sn" }, { "@identifier": "bass" } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "reverb" }, { "@number": 0.9 }, { "@number": 11 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "lfo" }, { "@division": "1/4" }, { "@identifier": "up" } ] } } ] } } }, { "@object": { "@new": { "@inst": "sample", "@type": { "@array": [ { "@identifier": "kick_min" }, { "@identifier": "snare_dub" } ] }, "@functions": [ { "@function": { "@name": "time", "@args": [ { "@division": "1/16" } ] } }, { "@function": { "@name": "env", "@args": [ { "@number": 1 }, { "@division": "1/32" }, { "@number": 2 } ] } }, { "@function": { "@name": "beat", "@args": [ { "@number": 0.9 } ] } } ] } } }, { "@object": { "@new": { "@inst": "synth", "@type": { "@identifier": "sine" }, "@functions": [ { "@function": { "@name": "name", "@args": [ { "@identifier": "aSynth" } ] } } ] } } }, { "@object": { "@set": { "@name": "aSynth", "@functions": [ { "@function": { "@name": "note", "@args": [ { "@identifier": "notes" }, { "@number": 1 } ] } }, { "@function": { "@name": "time", "@args": [ { "@division": "1/16" } ] } }, { "@function": { "@name": "env", "@args": [ { "@number": 1000 }, { "@number": 200 } ] } }, { "@function": { "@name": "beat", "@args": [ { "@number": 0.8 } ] } }, { "@function": { "@name": "group", "@args": [ { "@identifier": "sn" }, { "@identifier": "ld" } ] } } ] } } }, { "@object": { "@set": { "@name": "aSynth", "@functions": [ { "@function": { "@name": "amp", "@args": [ { "@number": 0.5 }, { "@number": 100 } ] } } ] } } }, { "@object": { "@set": { "@name": "aSynth", "@functions": [ { "@function": { "@name": "wave2", "@args": [ { "@identifier": "sine" }, { "@number": 2 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "drive" }, { "@number": 16 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "lfo" }, { "@division": "1/4" }, { "@identifier": "sine" } ] } } ] } } }, { "@object": { "@new": { "@inst": "synth", "@type": { "@identifier": "saw" }, "@functions": [ { "@function": { "@name": "name", "@args": [ { "@identifier": "bSynth" } ] } } ] } } }, { "@object": { "@set": { "@name": "bSynth", "@functions": [ { "@function": { "@name": "note", "@args": [ { "@function": { "@name": "random", "@args": [ { "@number": 4 }, { "@number": 0 }, { "@number": 12 } ] } }, { "@number": 2 } ] } }, { "@function": { "@name": "time", "@args": [ { "@division": "1/16" } ] } }, { "@function": { "@name": "env", "@args": [ { "@number": 300 }, { "@number": 1000 } ] } } ] } } }, { "@object": { "@set": { "@name": "bSynth", "@functions": [ { "@function": { "@name": "pan", "@args": [ { "@identifier": "random" } ] } }, { "@function": { "@name": "group", "@args": [ { "@identifier": "bass" }, { "@identifier": "intro" } ] } } ] } } }, { "@object": { "@set": { "@name": "bSynth", "@functions": [ { "@function": { "@name": "amp", "@args": [ { "@number": 0 } ] } }, { "@function": { "@name": "beat", "@args": [ { "@number": 0.7 } ] } } ] } } }, { "@object": { "@new": { "@inst": "sample", "@type": { "@identifier": "kick_min" }, "@functions": [ { "@function": { "@name": "name", "@args": [ { "@identifier": "kck" } ] } } ] } } }, { "@object": { "@set": { "@name": "kck", "@functions": [ { "@function": { "@name": "time", "@args": [ { "@division": "1/4" } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "drive" }, { "@number": 1.1 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "filter" }, { "@identifier": "low" }, { "@number": 500 }, { "@number": 0.3 } ] } } ] } } }, { "@object": { "@new": { "@inst": "midi", "@type": { "@string": "to Max 1" }, "@functions": [ { "@function": { "@name": "name", "@args": [ { "@identifier": "myMidi" } ] } } ] } } }, { "@object": { "@set": { "@name": "myMidi", "@functions": [ { "@function": { "@name": "time", "@args": [ { "@division": "1/8" } ] } }, { "@function": { "@name": "env", "@args": [ { "@number": 150 } ] } }, { "@function": { "@name": "out", "@args": [ { "@number": 2 } ] } } ] } } }, { "@object": { "@set": { "@name": "myMidi", "@functions": [ { "@function": { "@name": "add_fx", "@args": [ { "@number": 15 }, { "@number": 100 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@number": 22 }, { "@number": 60 } ] } } ] } } }, { "@object": { "@set": { "@name": "all", "@functions": [ { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "reverb" }, { "@number": 1 }, { "@number": 20 } ] } }, { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "chip" }, { "@number": 0.5 } ] } } ] } } }, { "@object": { "@set": { "@name": "sn", "@functions": [ { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "reverb" }, { "@number": 0.9 }, { "@number": 17 } ] } } ] } } }, { "@object": { "@set": { "@name": "bass", "@functions": [ { "@function": { "@name": "add_fx", "@args": [ { "@identifier": "drive" }, { "@number": 5 } ] } } ] } } } ] }, "errors": [ "Unkown instrument or setting: sn", "Unkown instrument or setting: bass" ] }