I’m not sure what the returned data looks like for that method, but generating that shouldn’t be too hard.
All you have to do is get the amplitude a
function waveSize(frequencies, amplitudes, time)
local result = 0
for i = 1, #frequencies do
local freq = frequencies[i]
local amp = amplitudes[i]
--[[
explanation:
sine waves can be positive or negative depending on time t. All we need to
do is get the value of the sine wave at time t and add it to the total
]]
result = result + amp * math.sin(freq * time)
end
return result
end
Here’s a game link to showcase this (uncopylocked):
Hey @metatablecatmaid – the API takes a timeRange as a NumberRange, and a desired number of samples – the result is a table containing up to samples volume levels spanning the timeRange
I don’t think any sine math should be necessary; just iterating over the table can visualize the waveform pretty directly; e.x. this is rbxasset://sounds/uuhhh.mp3
i think i got it, but something doesn’t feel right here, I wonder if its possible to take a multiple of the width then just return the max and min from the bin?
Neither of these things are drawbacks for a scripting language. This isn’t rust. The idea of adding “bloat” to the API is very counter productive, it makes it so developers need to be writing the same functions over and over and over again and makes it more likely for new developers to make mistakes. These functions should be added for convenience not out of necessity
One of the design choices behind vanilla Lua was that if you can do it in Lua and there isn’t a large performance improvement from doing it in C, it doesn’t need to be added to the standard library.
I dont agree with this design approach at all because a lot of things are cleanly implemented in C++ and its easier to just expose a userdata or function to it rather than making the developer pick up the mantle and do it themselves.
This is amazing! Audio updates keeping coming out and surprising me, and I’m all for it.
I remember trying to do this with Sounds years ago and giving up after a few hours… I’m seriously looking forwards to implementing this in my Audio plugin with ease!
Roblox doesn’t even support git, thats not a valid reason. Developing software on Roblox is nothing like developing software for any other language. The point is to make it as easy as possible for developers to create high quality games. Holding back on adding more utility functions just because of bloat, all it does is make it harder to create high quality games. What is the benefit of not adding these functions, you see too many things in autofill?
The point is for the developers to share useful libraries without limitations placed by Roblox on what they contain.
These problems are solved by code sharing and reuse and not by waiting for Roblox to add specific built-in functionality.
I might’ve misread but what’s the point of suddenly throwing an error if you use actors in plugins? The crash was a bug with pretty specific circumstances. I hope that’s not what this says. It doesn’t matter if it wasn’t “officially” supported, it’s been a thing for quite some time and a lot of my plugins out there rely on this and will completely break with this change, and if I fix them to take the actors out - well then the plugins will relatively suck.
I hope I misread because I know Roblox is all about not breaking stuff developers rely on support for actors in plugins shouldn’t just suddenly disappear