Page 2 of 2
Re: LÖVE Audio Effects Playground
Posted: Mon Aug 29, 2022 9:55 pm
by ReFreezed
I actually thought about that - allowing the user to rewire things however they want - but since it doesn't change the outputted audio it would just be confusing.
Re: LÖVE Audio Effects Playground
Posted: Tue Aug 30, 2022 11:06 am
by pgimeno
That's very cool indeed! Extra points if the cables are shaped like a catenary
Re: LÖVE Audio Effects Playground
Posted: Tue Aug 30, 2022 6:54 pm
by ReFreezed
It's more or less two sines added together which I don't think counts as a catenary shape, so no extra points I guess.
Re: LÖVE Audio Effects Playground
Posted: Tue Aug 30, 2022 8:29 pm
by pgimeno
I don't blame you, it gets
really complex. Still very cool though.
The use of sines was a bit surprising. I thought you would have used Bézier curves. It's what I would have used probably.
Re: LÖVE Audio Effects Playground
Posted: Tue Aug 30, 2022 10:50 pm
by ReFreezed
I just needed the cables to sag a bit, and sines have those saggy bits!
No idea that shape this actually is.
Code: Select all
-- (hiX,hiY) is the higher connection on the screen.
-- (loX,loY) is the lower.
for segment = 0, SEGMENTS do
local tx = segment / SEGMENTS -- Move linearly on x.
local ty = sin(tx*TAU/4) -- Quickly approach lower y (ty=1).
local sag = sin(tx*TAU/2) * MAX_SAG -- Sag in the middle.
local segmentX = lerp(hiX, loX, tx)
local segmentY = lerp(hiY, loY, ty) + sag
end
Re: LÖVE Audio Effects Playground
Posted: Tue Aug 30, 2022 11:11 pm
by ReFreezed
Well, extending a line reveals the true shape.
Re: LÖVE Audio Effects Playground
Posted: Sun Sep 25, 2022 10:00 am
by zorg
Awesome little educational tool! I usually can't keep up with the Games subforum, but this is great.
Re: LÖVE Audio Effects Playground
Posted: Sun Sep 25, 2022 5:48 pm
by ReFreezed
Thanks
Re: LÖVE Audio Effects Playground
Posted: Mon Sep 26, 2022 2:30 pm
by pgimeno
I was bothered by the fact that the sine waves straighten up unnaturally near one of the ends, so I ended up making a parabolic version. A parabola is a decent-ish approximation of a catenary in many cases.
(Rename to main.lua to test)
Re: LÖVE Audio Effects Playground
Posted: Mon Sep 26, 2022 5:52 pm
by ReFreezed
That's nice. I'll save that code for the future.
In the program, the cables swing back and forth a bit. Could you implement physically correct swinging as well?
(Just kidding.)