add pitchscaler cmd

This commit is contained in:
Luna 2019-07-10 17:31:18 -03:00
parent f9898b2f11
commit ab9eaa1400
4 changed files with 25 additions and 10 deletions

View File

@ -83,6 +83,12 @@ Parameters:
- `law_freq`: LFO frequency (Hz), 2..30, default 9
- `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.
## TODO `echo split index delay`
Run an echo filter on the given loaded file.

4
examples/pitch.scri Normal file
View File

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

View File

@ -19,6 +19,7 @@ pub const CommandType = enum {
Phaser,
Mbeq,
Chorus,
PitchScaler,
};
pub const Command = struct {
@ -126,6 +127,7 @@ pub const Lang = struct {
_ = try self.keywords.put("mbeq", .Mbeq);
_ = try self.keywords.put("phaser", .Phaser);
_ = try self.keywords.put("chorus", .Chorus);
_ = try self.keywords.put("pitchscaler", .PitchScaler);
}
pub fn parse(self: *Lang, data: []const u8) !CommandList {

View File

@ -173,11 +173,7 @@ pub const Runner = struct {
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 params = ParamList.init(self.allocator);
defer params.deinit();
@ -193,15 +189,16 @@ pub const Runner = struct {
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();
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 runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -267,6 +264,12 @@ pub const Runner = struct {
try self.chorusCmd(pos, params);
},
.PitchScaler => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "mult", 2);
try self.pitchScalerCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;