-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Details
I am not sure if this is a suggestion or a bug report, so I'll go with bug report.
I am a huge fan of making adaptive music, but I always noticed "stitches" when I try to do something more than basic looping via start_cue and end_cue (looping it through Lua). I always though that "meh, it's just my script having wrong timings", but after thorough testing, I was VERY wrong. It is some quirk of the Source Engine.
Every time you play two sounds - even wav's - as long as they're not looped view start_cue and end_cue, there will be an audible stitch, no matter the timing. There is even a stitch if you play the second sound before the first, it never instantly snaps like other games (the Python library pygame can seamlessly stitch sounds that are already perfect if put next to each other).
This makes my system a thousand times worse, and I would appreciate a fix of it.
PLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASEPLEASE-
Steps to reproduce
It is hard to replicate the error with just Lua code. Grab any sound (for example music) that is NOT a loop via start_cue and end_cue (https://developer.valvesoftware.com/wiki/Looping_a_sound for more information on what the Hell those are), and separate it into two wav's. Play the first half, and then the second half after the first elapses.
local SOUND_A = "Path/To/First/Half.wav"
local SOUND_B = "Path/To/Second/Half.wav"
local pSoundA, pSoundB, flTime, bSecondPart, bIsOver
hook.Add( "RenderScreenspaceEffects", "Stitch", function()
if bIsOver then return end
if bSecondPart then
if RealTime() > flTime then
pSoundB = CreateSound( Entity( 1 ), Sound( SOUND_B ) )
pSoundB:Play()
bIsOver = true
end
else
if !pSoundA then
pSoundA = CreateSound( Entity( 1 ), Sound( SOUND_A ) )
pSoundA:Play()
flTime = RealTime() + SoundDuration( SOUND_A )
bSecondPart = true
end
end
end )
Version of the game
Protocol version 24
Network version 2025.03.26 (garrysmod)
Exe build: 15:41:51 Dec 10 2025 (9860) (4000)
GMod version 2025.12.10, branch: public, multicore: 0
Windows 32bit
Beta
None/Public/Default/Main