Any way to get playback loudness of sound part instantly?

I’m trying to get playback loudness of a certain time by changing time position of sound and make graph of it

I tried changing time position of sound and get loudness but it only returns 0 at any time position.

local sound = script.music
while sound.IsLoaded == false do
	wait()
end
sound:Play()
sound.TimePosition = 0
for count = 1, sound.TimeLength * 10 do
	print(sound.PlaybackLoudness)
	sound.TimePosition = count / 10
end

Are you reading this from the server or client? PlaybackLoudness is not replicated across the server/client boundary

I’m reading it as client. I ran all codes in local script, Also it prints loudness normally if I just don’t change time position. But I don’t want to wait for get sound data until sound ends, that’s why I’m trying to change time position and get loudness.

What have you set the volume of the sound to?

Can you not just use GetPropertyChangedSignal with the time, then make a table that saves the loudness value to a table indexed by the current time when you play the sound. Then print that table after the sound has finished playing. Then you would basically have all the data you need for the graph.

1 Like

Alright, so I tested it out and got it working. You’re running through the sound far too fast. Add a wait(0.05)

I do believe there are better ways to do this, however. I think it’s best to just let the sound play out, log each “tick’s” volume, then graph it from that

Lets say we had a 10 second sound.
Instead of getting all the data by waiting 10 seconds we could make a clone for each second there is.

So we would clone the sound 10 times
set the volume to 0 (so we don’t hear all the sounds playing at once)
then we would have a clone play at 0 seconds, 1 seconds, 2 seconds… ect.
We would only have to wait 1 second to render the whole sound.