You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use several loudness blocks, they should not cause the loudness analysis code to run multiple times in a single scratch animation frame.
Actual behavior
Each time a loudness reporter is called it runs the loudness analysis.
Steps to reproduce
This program uses a run-without-screen-refresh custom block to check the loudness 100,000 times, and measure the time it takes:
On Scratch 2.0 on my machine, this reports 0.08 seconds, and on Scratch 3.0 it reports about 0.45 seconds.
Notes
One strategy for improving this would be store a timestamp each time the loudness is requested, and also store the loudness value itself. Then, each time, if the current time is long enough after the timestamp (e.g. one frame at 30fps- since we are not measuring the platform's audio buffer duration), then make a new measurement- otherwise just return the stored value. For the program above, this should result in the loudness analysis being done once each time the custom block is run, instead of 100,000 times.
Operating system and browser
Mac OS 10.12.6 Chrome 63
The text was updated successfully, but these errors were encountered:
Expected behavior
If you use several loudness blocks, they should not cause the loudness analysis code to run multiple times in a single scratch animation frame.
Actual behavior
Each time a loudness reporter is called it runs the loudness analysis.
Steps to reproduce
This program uses a run-without-screen-refresh custom block to check the loudness 100,000 times, and measure the time it takes:
On Scratch 2.0 on my machine, this reports 0.08 seconds, and on Scratch 3.0 it reports about 0.45 seconds.
Notes
One strategy for improving this would be store a timestamp each time the loudness is requested, and also store the loudness value itself. Then, each time, if the current time is long enough after the timestamp (e.g. one frame at 30fps- since we are not measuring the platform's audio buffer duration), then make a new measurement- otherwise just return the stored value. For the program above, this should result in the loudness analysis being done once each time the custom block is run, instead of 100,000 times.
Operating system and browser
Mac OS 10.12.6 Chrome 63
The text was updated successfully, but these errors were encountered: