Skip to content

Commit

Permalink
Fix Band Drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
potistudio committed Mar 20, 2024
1 parent 7f13a05 commit f1dedc4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Goertzel Audio Spectrum.obj
Original file line number Diff line number Diff line change
Expand Up @@ -205,26 +205,26 @@ resultBuffer = processedSpectrumBuffer
-------- Draw --------
obj.load ("figure", "円", color, thickness)
if displayType ~= 1 then
for i = 1, #resultBuffer do
local posX = remap (i / #resultBuffer, 0, 1, startPoint, endPoint)
obj.draw (posX, resultBuffer[i] * -heightMulplier * 0.0001, 0)
for i = 0, #resultBuffer - 1 do
local posX = remap (i / (#resultBuffer - 1), 0, 1, startPoint, endPoint)
obj.draw (posX, resultBuffer[i + 1] * -heightMulplier * 0.0001, 0)
end
end

obj.load ("figure", "四角形", color, 1)
if displayType ~= 2 then
for i = 1, #resultBuffer do
for i = 0, #resultBuffer - 1 do
local S = {}
for i = 1, 4 do
S[i] = {}
for j = 1, 4 do
S[j] = {}
end

local posX = remap (i / #resultBuffer, 0, 1, startPoint, endPoint)
local posX = remap (i / (#resultBuffer - 1), 0, 1, startPoint, endPoint)

S[1][1] = posX - (thickness / 2)
S[1][2] = resultBuffer[i] * heightMulplier * 0.0001
S[1][2] = resultBuffer[i + 1] * heightMulplier * 0.0001
S[2][1] = posX + (thickness / 2)
S[2][2] = resultBuffer[i] * heightMulplier * 0.0001
S[2][2] = resultBuffer[i + 1] * heightMulplier * 0.0001

S[3][1] = posX + (thickness / 2)
S[3][2] = 0
Expand Down

0 comments on commit f1dedc4

Please sign in to comment.