Compare commits

..

No commits in common. "3a8f84a3b23fe6bf8df07ba0b557920c29d15d61" and "f9898b2f110e9e6708c8d0a28466f51e4f9b8349" have entirely different histories.

8 changed files with 31 additions and 111 deletions

View file

@ -18,7 +18,6 @@ glitch art "framework", ???????? language??? something?
## plugin depedencies: ## plugin depedencies:
- lv2 default plugins (most specifically the eg-amp plugin) - lv2 default plugins (most specifically the eg-amp plugin)
- the SWH plugins ( https://github.com/swh/lv2 ) - the SWH plugins ( https://github.com/swh/lv2 )
- the Invada Studio plugins ( https://launchpad.net/invada-studio/ )
```bash ```bash
# build and install # build and install

View file

@ -83,27 +83,6 @@ Parameters:
- `law_freq`: LFO frequency (Hz), 2..30, default 9 - `law_freq`: LFO frequency (Hz), 2..30, default 9
- `attendb`: Output attenuation (dB), -20..0, default 0 - `attendb`: Output attenuation (dB), -20..0, default 0
## `pitchscaler split index mult`
Runs the Higher Quality Pitch Scaler from the SWH plugins.
The `mult` parameter is the pitch coefficient, range from 0.5..2, default 1.
## `reverb split index roomLength roomHeight sourceLR sourceFB listLR listFB hpf warmth diffusion`
Run the Early Reflection Reverb from the Invada Studio plugins.
**TODO** Parameter list
## `highpass split index freq gain noClip`
Run the High Pass Filter from the Invada Studio plugins.
Parameters:
- `freq`: Frequency. 20-20000, default 1000
- `gain`: Gain, 0-12, default 0
- `noClip`: Soft Clip (assumed boolean), 0-1, default 0
## TODO `echo split index delay` ## TODO `echo split index delay`
Run an echo filter on the given loaded file. Run an echo filter on the given loaded file.

View file

@ -1,3 +0,0 @@
load :0;
highpass 3 1 7800 0 0;
quicksave;

View file

@ -1,4 +0,0 @@
load :0;
pitchscaler 3 1 1.0000000000001;
pitchscaler 10 8 0.999999999999;
quicksave;

View file

@ -1,3 +0,0 @@
load :0;
reverb 3 1 25 30 0 0.8 0 0.2 1000 50 50;
quicksave;

View file

@ -19,15 +19,11 @@ pub const CommandType = enum {
Phaser, Phaser,
Mbeq, Mbeq,
Chorus, Chorus,
PitchScaler,
Reverb,
Highpass,
}; };
pub const Command = struct { pub const Command = struct {
command: CommandType, command: CommandType,
args: ArgList, args: ArgList,
cur_idx: usize = 0,
pub fn print(self: *const Command) void { pub fn print(self: *const Command) void {
std.debug.warn("cmd:{}\n", self.command); std.debug.warn("cmd:{}\n", self.command);
@ -49,8 +45,7 @@ pub const Command = struct {
return try std.fmt.parseInt(usize, arg, 10); return try std.fmt.parseInt(usize, arg, 10);
} }
pub fn consumePosition(self: *Command) !plugin.Position { pub fn consumePosition(self: *const Command) !plugin.Position {
self.cur_idx = 2;
return plugin.Position{ return plugin.Position{
.split = try self.usizeArgAt(0), .split = try self.usizeArgAt(0),
.index = try self.usizeArgAt(1), .index = try self.usizeArgAt(1),
@ -90,13 +85,12 @@ pub const Command = struct {
} }
pub fn appendParam( pub fn appendParam(
self: *Command, self: *const Command,
params: *plugin.ParamList, params: *plugin.ParamList,
symbol: []const u8, symbol: []const u8,
idx: usize,
) !void { ) !void {
var val = try self.floatArgAt(self.cur_idx); var val = try self.floatArgAt(idx);
self.cur_idx += 1;
try params.append(plugin.Param{ try params.append(plugin.Param{
.sym = symbol, .sym = symbol,
.value = val, .value = val,
@ -132,9 +126,6 @@ pub const Lang = struct {
_ = try self.keywords.put("mbeq", .Mbeq); _ = try self.keywords.put("mbeq", .Mbeq);
_ = try self.keywords.put("phaser", .Phaser); _ = try self.keywords.put("phaser", .Phaser);
_ = try self.keywords.put("chorus", .Chorus); _ = try self.keywords.put("chorus", .Chorus);
_ = try self.keywords.put("pitchscaler", .PitchScaler);
_ = try self.keywords.put("reverb", .Reverb);
_ = try self.keywords.put("highpass", .Highpass);
} }
pub fn parse(self: *Lang, data: []const u8) !CommandList { pub fn parse(self: *Lang, data: []const u8) !CommandList {

View file

@ -74,7 +74,7 @@ pub const RunContext = struct {
return RunContext{ return RunContext{
.in_buf = try allocator.alloc(f32, 1), .in_buf = try allocator.alloc(f32, 1),
.out_buf = try allocator.alloc(f32, 2), .out_buf = try allocator.alloc(f32, 1),
.instance = instance.?, .instance = instance.?,
}; };
} }

View file

@ -173,7 +173,11 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/lfoPhaser", position, params); try image.runPlugin("http://plugin.org.uk/swh-plugins/lfoPhaser", position, params);
} }
fn mbeqCmd(self: *Runner, position: Position, bands: []const f32) !void { fn mbeqCmd(
self: *Runner,
position: Position,
bands: []const f32,
) !void {
var image = try self.getImage(); var image = try self.getImage();
var params = ParamList.init(self.allocator); var params = ParamList.init(self.allocator);
defer params.deinit(); defer params.deinit();
@ -189,26 +193,15 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/mbeq", position, params); try image.runPlugin("http://plugin.org.uk/swh-plugins/mbeq", position, params);
} }
fn chorusCmd(self: *Runner, pos: Position, params: ParamList) !void { fn chorusCmd(
self: *Runner,
pos: Position,
params: ParamList,
) !void {
var image = try self.getImage(); var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/multivoiceChorus", pos, params); try image.runPlugin("http://plugin.org.uk/swh-plugins/multivoiceChorus", pos, params);
} }
fn pitchScalerCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/pitchScaleHQ", pos, params);
}
fn reverbCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://invadarecords.com/plugins/lv2/erreverb/mono", pos, params);
}
fn highpassCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://invadarecords.com/plugins/lv2/filter/hpf/mono", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void { fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator); var params = ParamList.init(self.allocator);
defer params.deinit(); defer params.deinit();
@ -224,22 +217,22 @@ pub const Runner = struct {
.Amp => blk: { .Amp => blk: {
const pos = try cmd.consumePosition(); const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "gain"); try cmd.appendParam(&params, "gain", 2);
try self.ampCmd(pos, params); try self.ampCmd(pos, params);
}, },
.RFlanger => blk: { .RFlanger => blk: {
const pos = try cmd.consumePosition(); const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "delay_depth_avg"); try cmd.appendParam(&params, "delay_depth_avg", 2);
try cmd.appendParam(&params, "law_freq"); try cmd.appendParam(&params, "law_freq", 3);
try self.rFlangerCmd(pos, params); try self.rFlangerCmd(pos, params);
}, },
.Eq => blk: { .Eq => blk: {
const pos = try cmd.consumePosition(); const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "lo"); try cmd.appendParam(&params, "lo", 2);
try cmd.appendParam(&params, "mid"); try cmd.appendParam(&params, "mid", 3);
try cmd.appendParam(&params, "hi"); try cmd.appendParam(&params, "hi", 4);
try self.eqCmd(pos, params); try self.eqCmd(pos, params);
}, },
@ -247,10 +240,10 @@ pub const Runner = struct {
.Phaser => blk: { .Phaser => blk: {
const pos = try cmd.consumePosition(); const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "lfo_rate"); try cmd.appendParam(&params, "lfo_rate", 2);
try cmd.appendParam(&params, "lfo_depth"); try cmd.appendParam(&params, "lfo_depth", 3);
try cmd.appendParam(&params, "fb"); try cmd.appendParam(&params, "fb", 4);
try cmd.appendParam(&params, "spread"); try cmd.appendParam(&params, "spread", 5);
try self.phaserCmd(pos, params); try self.phaserCmd(pos, params);
}, },
@ -264,48 +257,16 @@ pub const Runner = struct {
.Chorus => blk: { .Chorus => blk: {
const pos = try cmd.consumePosition(); const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "voices"); try cmd.appendParam(&params, "voices", 2);
try cmd.appendParam(&params, "delay_base"); try cmd.appendParam(&params, "delay_base", 3);
try cmd.appendParam(&params, "voice_spread"); try cmd.appendParam(&params, "voice_spread", 4);
try cmd.appendParam(&params, "detune"); try cmd.appendParam(&params, "detune", 5);
try cmd.appendParam(&params, "law_freq"); try cmd.appendParam(&params, "law_freq", 6);
try cmd.appendParam(&params, "attendb"); try cmd.appendParam(&params, "attendb", 7);
try self.chorusCmd(pos, params); try self.chorusCmd(pos, params);
}, },
.PitchScaler => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "mult");
try self.pitchScalerCmd(pos, params);
},
.Reverb => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "roomLength");
try cmd.appendParam(&params, "roomHeight");
try cmd.appendParam(&params, "sourceLR");
try cmd.appendParam(&params, "sourceFB");
try cmd.appendParam(&params, "listLR");
try cmd.appendParam(&params, "listFB");
try cmd.appendParam(&params, "hpf");
try cmd.appendParam(&params, "warmth");
try cmd.appendParam(&params, "diffusion");
try self.reverbCmd(pos, params);
},
.Highpass => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "freq");
try cmd.appendParam(&params, "gain");
try cmd.appendParam(&params, "noClip");
try self.highpassCmd(pos, params);
},
else => blk: { else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command); std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand; break :blk RunError.UnknownCommand;