From b9160adad2899af49c3addfdbcf58aa5250cf19c Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 11 Jul 2019 10:20:09 -0300 Subject: [PATCH] add delay cmd --- doc/README.md | 20 +++++++++++++++++--- examples/delay.scri | 3 +++ src/lang.zig | 2 ++ src/runner.zig | 22 ++++++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 examples/delay.scri diff --git a/doc/README.md b/doc/README.md index 73b81b1..e895de2 100644 --- a/doc/README.md +++ b/doc/README.md @@ -100,9 +100,23 @@ Run the Early Reflection Reverb from the Invada Studio plugins. 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 + - `freq`: Frequency. 20..20000, default 1000 + - `gain`: Gain, 0..12, default 0 + - `noClip`: Soft Clip (assumed boolean), 0..1, default 0 + +## `delay seed gain` + +Parameters: + - `seed`: Random seed, 0..1000, default 0 + - `gain`: Input gain (dB), -96..24, default 0 + - `feedback_pc`: Feedback (%), 0..100, default 0 + - `tap_count`: Number of taps, 2..128, default 2 + - `first_delay`: First delay (s), 0..5, default 0 + - `delay_range`: Delay range (s), 0..6, default 6 + - `delay_scale`: Delay change, 0..5, default 1 + - `delay_rand_pc`: Delay random (%), 0..100, default 0 + - `gain_scale`: Amplitude change, 0.2..5, default 1 + - `wet`: Dry/wet mix, 0..1, default 1 ## TODO `echo split index delay` diff --git a/examples/delay.scri b/examples/delay.scri new file mode 100644 index 0000000..538c565 --- /dev/null +++ b/examples/delay.scri @@ -0,0 +1,3 @@ +load :0; +delay 3 1 0 0 0 2 0 6 1 0 1 1; +quicksave; diff --git a/src/lang.zig b/src/lang.zig index d15e657..fc5f1d6 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -23,6 +23,7 @@ pub const CommandType = enum { PitchScaler, Reverb, Highpass, + Delay, }; pub const Command = struct { @@ -137,6 +138,7 @@ pub const Lang = struct { _ = try self.keywords.put("pitchscaler", .PitchScaler); _ = try self.keywords.put("reverb", .Reverb); _ = try self.keywords.put("highpass", .Highpass); + _ = try self.keywords.put("delay", .Delay); } pub fn parse(self: *Lang, data: []const u8) !CommandList { diff --git a/src/runner.zig b/src/runner.zig index d272fac..a8042ca 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -230,6 +230,11 @@ pub const Runner = struct { try image.runPlugin("http://invadarecords.com/plugins/lv2/filter/hpf/mono", pos, params); } + fn delayCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://plugin.org.uk/swh-plugins/delayorama", pos, params); + } + fn runCommand(self: *Runner, cmd: *lang.Command) !void { var params = ParamList.init(self.allocator); defer params.deinit(); @@ -328,6 +333,23 @@ pub const Runner = struct { try self.highpassCmd(pos, params); }, + .Delay => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "seed"); + try cmd.appendParam(¶ms, "gain"); + try cmd.appendParam(¶ms, "feedback_pc"); + try cmd.appendParam(¶ms, "tap_count"); + try cmd.appendParam(¶ms, "first_delay"); + try cmd.appendParam(¶ms, "delay_range"); + try cmd.appendParam(¶ms, "delay_scale"); + try cmd.appendParam(¶ms, "delay_rand_pc"); + try cmd.appendParam(¶ms, "gain_scale"); + try cmd.appendParam(¶ms, "wet"); + + try self.delayCmd(pos, params); + }, + else => blk: { std.debug.warn("Unsupported command: {}\n", cmd.command); break :blk RunError.UnknownCommand;