[Sound] Something to allow us to overlap sound multiple times

As a Roblox developer, it is currently impossible to play sounds repeatedly without them cutting off.
You have to resort to hacks like this one I made (for my UI).

https://twitter.com/DawgraRBX/status/932003997321515009

I honestly think there should be a variable which makes an audio overlay, when it’s played once again.
I remember old Roblox builds were allowing developers to do that - ROBLOX Base Wars made by staff has gun sound issues right now.
They used to go “Pew-pew-pew-pew”, now they go “------pew”.

If Roblox staff ever considers that, It would prevent me from doing ugly hacks like this.

It would also prevent one of scripting mistakes - cloning the audio, pasting it and playing it. You might have some performance issues doing so!

There might be one issue though, what if people abuse it to make audio SUPER LOUD?

8 Likes

Could you explain why the Looped property does not achieve what you want to do? I’m a little unclear as to what exactly you’re trying to achieve and others probably are too.

EDIT: So I just figured that you want to play a sound again in such a way that the second :Play() causes the sound to overlap the ending of the previous? You should probably clarify this as it wasn’t clear until I wondered why you’d need a ‘looping’ sound in a UI. :smile:

I think it would be a nice feature to have, although its use case is somewhat limited and I’m not sure how much I’d actually need such behaviour.

I fixed title.

This behavior used to be possible, but was phased out because it’s incompatible with the newer sound APIs, specifically TimePosition.

The current solution is to create one Sound instance for each sound you want to play. For things like gunfire, you can optimize a bit by recycling spent Sound instances. Or, if you know the rate of fire and the length of the sound beforehand, you can create enough Sound instances to accommodate that rate. This is simply the sound length divided by the rate of fire, rounded up.

Alternatively, if you’re into sound editing, you could bake the rate of fire into the sound itself. Ideally, a sound starts, seamlessly loops somewhere in the middle for the duration the sound is meant to play, and then ends.

[start    [loop start    loop end]    end]

Unfortunately, it is not currently possible to do this well on Roblox. The timing of events in Roblox is too imprecise for what sound requires, so you’ll end up with stuttering, or tiny gaps of silence.

2 Likes

Well, since my UI sound is quite dynamic - I’m resorting to my hack.