Skip to content

Commit

Permalink
Fix 2D table max_val assign in prelude function normalize_peaks() (su…
Browse files Browse the repository at this point in the history
  • Loading branch information
nuoun authored Dec 10, 2024
1 parent 81c7e68 commit 3a4ff98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lua/wtse_prelude.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ end
--- BUILT-IN MODULATORS ---


-- returns a table or multidimensional table with values from the input table,
-- returns a table or two dimensional table with values from the input table,
-- peak-normalized such that the maximum absolute value equals 1 (default) or the specified norm_factor
function mod.normalize_peaks(t, norm_factor)
norm_factor = norm_factor or 1
local max_val = 0
local o = {}
if type(t[1]) == "table" then
for _, frame in ipairs(t) do
max_val = math.max_abs(frame)
max_val = math.max(max_val, math.max_abs(frame))
end
else
max_val = math.max_abs(t)
Expand Down

0 comments on commit 3a4ff98

Please sign in to comment.