add delay cmd

This commit is contained in:
Luna 2019-07-11 10:20:09 -03:00
parent 79dc56daae
commit b9160adad2
4 changed files with 44 additions and 3 deletions

View file

@ -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`

3
examples/delay.scri Normal file
View file

@ -0,0 +1,3 @@
load :0;
delay 3 1 0 0 0 2 0 6 1 0 1 1;
quicksave;

View file

@ -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 {

View file

@ -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(&params, "seed");
try cmd.appendParam(&params, "gain");
try cmd.appendParam(&params, "feedback_pc");
try cmd.appendParam(&params, "tap_count");
try cmd.appendParam(&params, "first_delay");
try cmd.appendParam(&params, "delay_range");
try cmd.appendParam(&params, "delay_scale");
try cmd.appendParam(&params, "delay_rand_pc");
try cmd.appendParam(&params, "gain_scale");
try cmd.appendParam(&params, "wet");
try self.delayCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;