add rflanger command, update readme
This commit is contained in:
parent
2b2eb51dff
commit
8b189914f7
6 changed files with 54 additions and 6 deletions
12
README.md
12
README.md
|
@ -3,16 +3,22 @@ scritcher
|
|||
|
||||
glitch art "framework", ???????? language??? something?
|
||||
|
||||
![example of the amp command](https://estrogen.fun/i/57y7kn55.png)
|
||||
|
||||
![example of the rflanger command](https://estrogen.fun/i/i2055hdf.png)
|
||||
|
||||
# how do?
|
||||
|
||||
currently it can't do much other than running the eg-amp default lv2 plugin.
|
||||
|
||||
depedencies:
|
||||
## build depedencies:
|
||||
- zig at https://ziglang.org
|
||||
- libc, lilv and libsndfile
|
||||
- an appreciation for glitched anime girls on your hard drive
|
||||
- optional: imagemagick to convert from whatever to bmp
|
||||
|
||||
## plugin depedencies:
|
||||
- lv2 default plugins (most specifically the eg-amp plugin)
|
||||
- the SWH plugins ( https://github.com/swh/lv2 )
|
||||
|
||||
```bash
|
||||
# build and install
|
||||
# assumes lilv headers are at /usr/include/lilv-0, check build.zig if different
|
||||
|
|
|
@ -32,6 +32,10 @@ be a bmp. feel free to put other files, no warranties are given.)
|
|||
|
||||
Run the eg-amp plugin over the given slice of the file.
|
||||
|
||||
## `rflanger split index delay_depth_avg law_freq`
|
||||
|
||||
Runs the Retro Flanger script from the SWH plugins.
|
||||
|
||||
## TODO `echo split index delay`
|
||||
|
||||
Run an echo filter on the given loaded file.
|
||||
|
|
3
examples/flanger.scri
Normal file
3
examples/flanger.scri
Normal file
|
@ -0,0 +1,3 @@
|
|||
load :0;
|
||||
rflanger 3 1 2.5 1;
|
||||
quicksave;
|
|
@ -1,8 +1,8 @@
|
|||
load :0;
|
||||
amp 5 1 8;
|
||||
amp 7 4 2;
|
||||
amp 80 70 10;
|
||||
amp 80 73 20;
|
||||
amp 80 75 20;
|
||||
amp 80 76 20;
|
||||
amp 7 4 2;
|
||||
amp 5 1 8;
|
||||
quicksave;
|
||||
|
|
|
@ -10,6 +10,7 @@ pub const CommandType = enum {
|
|||
Noop,
|
||||
Load,
|
||||
Amp,
|
||||
RFlanger,
|
||||
Quicksave,
|
||||
};
|
||||
|
||||
|
@ -52,12 +53,15 @@ pub const CommandList = std.ArrayList(*Command);
|
|||
pub const ArgList = std.ArrayList([]const u8);
|
||||
|
||||
pub fn commandToCmdType(command: []const u8) ParseError!CommandType {
|
||||
// TODO make a hashmap for those
|
||||
if (std.mem.eql(u8, command, "noop")) {
|
||||
return CommandType.Noop;
|
||||
} else if (std.mem.eql(u8, command, "load")) {
|
||||
return CommandType.Load;
|
||||
} else if (std.mem.eql(u8, command, "amp")) {
|
||||
return CommandType.Amp;
|
||||
} else if (std.mem.eql(u8, command, "rflanger")) {
|
||||
return CommandType.RFlanger;
|
||||
} else if (std.mem.eql(u8, command, "quicksave")) {
|
||||
return CommandType.Quicksave;
|
||||
} else {
|
||||
|
|
|
@ -154,9 +154,10 @@ pub const Runner = struct {
|
|||
var image = try self.getImage();
|
||||
|
||||
var params = plugin.ParamList.init(self.allocator);
|
||||
try params.append(plugin.Param{ .sym = "gain", .value = gain });
|
||||
defer params.deinit();
|
||||
|
||||
try params.append(plugin.Param{ .sym = "gain", .value = gain });
|
||||
|
||||
// TODO if we could detect that the next command is a quicksave then
|
||||
// we don't need the temporary file in runPlugin and instead we
|
||||
// dump it all on the output image for it.
|
||||
|
@ -167,6 +168,27 @@ pub const Runner = struct {
|
|||
);
|
||||
}
|
||||
|
||||
fn rFlangerCmd(
|
||||
self: *Runner,
|
||||
split: usize,
|
||||
index: usize,
|
||||
delay_depth_avg: f32,
|
||||
law_freq: f32,
|
||||
) !void {
|
||||
var image = try self.getImage();
|
||||
var params = plugin.ParamList.init(self.allocator);
|
||||
defer params.deinit();
|
||||
|
||||
try params.append(plugin.Param{ .sym = "delay_depth_avg", .value = delay_depth_avg });
|
||||
try params.append(plugin.Param{ .sym = "law_freq", .value = law_freq });
|
||||
|
||||
try image.runPlugin(
|
||||
"http://plugin.org.uk/swh-plugins/retroFlange",
|
||||
plugin.Position{ .split = split, .index = index },
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
||||
return switch (cmd.command) {
|
||||
.Noop => {},
|
||||
|
@ -184,6 +206,15 @@ pub const Runner = struct {
|
|||
try self.ampCmd(split, index, gain);
|
||||
},
|
||||
|
||||
.RFlanger => blk: {
|
||||
const split = try cmd.usizeArgAt(0);
|
||||
const index = try cmd.usizeArgAt(1);
|
||||
const delay_depth_avg = try cmd.floatArgAt(2);
|
||||
const law_freq = try cmd.floatArgAt(3);
|
||||
|
||||
try self.rFlangerCmd(split, index, delay_depth_avg, law_freq);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unknown command: {}\n", cmd.command);
|
||||
break :blk RunError.UnknownCommand;
|
||||
|
|
Loading…
Reference in a new issue