add chorus command
This commit is contained in:
parent
317916a1e0
commit
5fb0f9c066
4 changed files with 58 additions and 1 deletions
|
@ -62,6 +62,8 @@ Parameters:
|
|||
|
||||
## `mbeq split index band_1 band_2 band_3 band_4 band_5 band_6 band_7 band_8 band_9 band_10 band_11 band_12 band_13 band_14 band_15`
|
||||
|
||||
Multiband EQ from the SWH plugins.
|
||||
|
||||
In respective order, the band arugments represent the:
|
||||
50Hz, 100Hz, 156Hz, 220Hz, 311Hz, 440Hz, 622Hz, 880Hz 1250Hz, 1750Hz, 2500Hz,
|
||||
3500Hz, 5000Hz, 10000Hz and 20000Hz frequencies.
|
||||
|
@ -69,6 +71,18 @@ In respective order, the band arugments represent the:
|
|||
All of them represent the band's gain in dB. The range is -70 to +30dB,
|
||||
default is 0.
|
||||
|
||||
## `chorus split index voices delay_base voice_spread detune law_freq attendb`
|
||||
|
||||
Multivoice Chrorus from the SWH plugins.
|
||||
|
||||
Parameters:
|
||||
- `voices`: Number of voices (int), 1..8, default 1
|
||||
- `delay_base`: Delay base (ms), 10..40, default 10
|
||||
- `voice_spread`: Voice separation (ms), 0-2, default 0.5
|
||||
- `detune`: Detune (%), 0..5, default 1
|
||||
- `law_freq`: LFO frequency (Hz), 2..30, default 9
|
||||
- `attendb`: Output attenuation (dB), -20..0, default 0
|
||||
|
||||
## TODO `echo split index delay`
|
||||
|
||||
Run an echo filter on the given loaded file.
|
||||
|
|
3
examples/chorus.scri
Normal file
3
examples/chorus.scri
Normal file
|
@ -0,0 +1,3 @@
|
|||
load :0;
|
||||
chorus 3 1 3 10 0.5 1 9 0;
|
||||
quicksave;
|
15
src/lang.zig
15
src/lang.zig
|
@ -18,6 +18,7 @@ pub const CommandType = enum {
|
|||
Eq,
|
||||
Phaser,
|
||||
Mbeq,
|
||||
Chorus,
|
||||
};
|
||||
|
||||
pub const Command = struct {
|
||||
|
@ -82,6 +83,19 @@ pub const Command = struct {
|
|||
|
||||
return arr.toSliceConst();
|
||||
}
|
||||
|
||||
pub fn appendParam(
|
||||
self: *const Command,
|
||||
params: *plugin.ParamList,
|
||||
symbol: []const u8,
|
||||
idx: usize,
|
||||
) !void {
|
||||
var val = try self.floatArgAt(idx);
|
||||
try params.append(plugin.Param{
|
||||
.sym = symbol,
|
||||
.value = val,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
pub const CommandList = std.ArrayList(*Command);
|
||||
|
@ -111,6 +125,7 @@ pub const Lang = struct {
|
|||
_ = try self.keywords.put("eq", .Eq);
|
||||
_ = try self.keywords.put("mbeq", .Mbeq);
|
||||
_ = try self.keywords.put("phaser", .Phaser);
|
||||
_ = try self.keywords.put("chorus", .Chorus);
|
||||
}
|
||||
|
||||
pub fn parse(self: *Lang, data: []const u8) !CommandList {
|
||||
|
|
|
@ -248,7 +248,19 @@ pub const Runner = struct {
|
|||
try image.runPlugin("http://plugin.org.uk/swh-plugins/mbeq", position, params);
|
||||
}
|
||||
|
||||
fn chorusCmd(
|
||||
self: *Runner,
|
||||
pos: plugin.Position,
|
||||
params: plugin.ParamList,
|
||||
) !void {
|
||||
var image = try self.getImage();
|
||||
try image.runPlugin("http://plugin.org.uk/swh-plugins/multivoiceChorus", pos, params);
|
||||
}
|
||||
|
||||
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
||||
var params = plugin.ParamList.init(self.allocator);
|
||||
defer params.deinit();
|
||||
|
||||
return switch (cmd.command) {
|
||||
.Noop => {},
|
||||
.Load => blk: {
|
||||
|
@ -301,8 +313,21 @@ pub const Runner = struct {
|
|||
try self.mbeqCmd(pos, bands);
|
||||
},
|
||||
|
||||
.Chorus => blk: {
|
||||
const pos = try cmd.consumePosition();
|
||||
|
||||
try cmd.appendParam(¶ms, "voices", 2);
|
||||
try cmd.appendParam(¶ms, "delay_base", 3);
|
||||
try cmd.appendParam(¶ms, "voice_spread", 4);
|
||||
try cmd.appendParam(¶ms, "detune", 5);
|
||||
try cmd.appendParam(¶ms, "law_freq", 6);
|
||||
try cmd.appendParam(¶ms, "attendb", 7);
|
||||
|
||||
try self.chorusCmd(pos, params);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unknown command: {}\n", cmd.command);
|
||||
std.debug.warn("Unsupported command: {}\n", cmd.command);
|
||||
break :blk RunError.UnknownCommand;
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue