User-uploaded audios use much more client memory than Roblox-uploaded audios

Reproduction Steps

We can reproduce the issue by inserting both user-uploaded audio and Roblox-uploaded audio with similar length and check its memory usage in developer console

Reference from repro baseplate - 12594339213 is user-uploaded audio clip and 1848354536 is Roblox-uploaded music audio
image

audio_memory_repro.rbxl (34.1 KB)

Expected Behavior

Memory usage of all kinds of audio should be in a similar extend and not a huge difference (Please see below attached references)

Actual Behavior

Reference 1 - User-uploaded 42 seconds audio in 38kbps bitrate uses around 7.5mb
image

Reference 2 - Roblox-uploaded 91 seconds audio in full bitrate quality uses around 0.1mb
image (1)

Issue Area: Engine
Issue Type: Performance
Impact: Moderate
Frequency: Constantly

7 Likes

Are you playing it as an audio stream or static object sound?

its an static object sound repro at the moment - for audio stream, do you mean playing audio without putting them into part in workspace?

Further reference - playing same audios in replicated storage without putting in workspace’s objects will produce same results

Screenshot 2023-02-24 165616

Hey Leonights, thanks for posting.

When playing an audio asset, there is a tradeoff between CPU and memory usage; the best thing for CPU time would be for all audio assets to be kept uncompressed, in-memory.
However, this is probably not a good idea generally, since uncompressed audio (such as .wav) can get pretty large.

Streaming audio assets from disk can use substantially less memory – but this uses more CPU, and depends on IO speeds.

Another consideration is that many Sounds can play the same asset at the same time, but possibly with different TimePosition values at any given time. If all assets were in-memory, duplicate Sounds could share a reference to the same asset, even if their TimePositions differ. However, if all assets were streamed from disk, each Sound would have to stream in a region of audio data around its TimePosition – in highly-duplicated scenarios, this can end up being even more memory than if we naively prioritized CPU!

The engine tries to weigh these considerations automatically, and make a decision based on context – it’s not perfect, but that could explain the disparity you are seeing. Generally: large, long assets will be streamed, whereas small assets might get decompressed directly into memory.

9 Likes

Yes.
Also, how are finding the audio file memory usage. I went looking through mine and couldn’t find anything audio related. I was looking under Client / Memory usage, should I be looking elsewhere?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.