-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluid-transients.lua
86 lines (69 loc) · 2.87 KB
/
fluid-transients.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
local info = debug.getinfo(1,'S');
local script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
loadfile(script_path .. "lib/reacoma.lua")()
if reacoma.settings.fatal then return end
local exe = reacoma.utils.wrap_quotes(
reacoma.settings.path .. "/fluid-transients"
)
local num_selected_items = reaper.CountSelectedMediaItems(0)
if num_selected_items > 0 then
local processor = reacoma.params.archetype.transients
reacoma.params.check_params(processor)
local param_names = "order,blocksize,padsize,skew,threshfwd,threshback,windowsize,clumplength"
local param_values = reacoma.params.parse_params(param_names, processor)
local confirm, user_inputs = reaper.GetUserInputs("Transients Parameters", 8, param_names, param_values)
if confirm then
reacoma.params.store_params(processor, param_names, user_inputs)
local params = reacoma.utils.split_comma(user_inputs)
local order = params[1]
local blocksize = params[2]
local padsize = params[3]
local skew = params[4]
local threshfwd = params[5]
local threshback = params[6]
local windowsize = params[7]
local clumplength = params[8]
local data = reacoma.layers.container
data.outputs = {
transients = {},
residual = {}
}
for i=1, num_selected_items do
reacoma.layers.get_data(i, data)
table.insert(
data.outputs.transients,
data.path[i] .. "_ts-t_" .. reacoma.utils.uuid(i) .. ".wav"
)
table.insert(
data.outputs.residual,
data.path[i] .. "_ts-r_" .. reacoma.utils.uuid(i) .. ".wav"
)
table.insert(
data.cmd,
exe ..
" -source " .. reacoma.utils.wrap_quotes(data.full_path[i]) ..
" -transients " .. reacoma.utils.wrap_quotes(data.outputs.transients[i]) ..
" -residual " .. reacoma.utils.wrap_quotes(data.outputs.residual[i]) ..
" -order " .. order ..
" -blocksize " .. blocksize ..
" -padsize " .. padsize ..
" -skew " .. skew ..
" -threshfwd " .. threshfwd ..
" -threshback " .. threshback ..
" -windowsize " .. windowsize ..
" -clumplength " .. clumplength ..
" -numframes " .. data.item_len_samples[i] ..
" -startframe " .. data.take_ofs_samples[i]
)
end
for i=1, num_selected_items do
reacoma.utils.cmdline(data.cmd[i])
reacoma.layers.exist(i, data)
end
reaper.SelectAllMediaItems(0, 0)
for i=1, num_selected_items do
reacoma.layers.process(i, data)
end
reacoma.utils.arrange("reacoma-transients")
end
end