I’m creating a script that determines whether a music asset is too loud for playback in-game and how much it has to be silenced to reach comfortable volume levels. To achieve this, I need a table of loudness samples of a music asset - at least 5 per second to get the most accurate results.
The problem is that the only way to get the volume samples is to play the music file and read the “PlaybackLoudness” property every script step which may not be a consistent 60 FPS - it ends up taking quite the time and the only way to speed things up is to create more instances of a sound playing at the same time at different “TimePosition”, but that causes significant lag EVEN on high end PC’s. On mobile it can result in a full second freeze.
I want a method that allows me to get a table of the same “PlaybackLoudness” value through the whole sound without the long wait (from a second to 10 seconds) and without lagging up any machine that runs it.