ezquake-source icon indicating copy to clipboard operation
ezquake-source copied to clipboard

BUG: Broken looping Sounds

Open jkr4m3r opened this issue 11 months ago • 10 comments

Please search for existing issues and check for potential duplicates before filing yours.

**ezQuake version:**3.6.5

OS/device including version: Win10

Describe the bug Ambient sounds are no longer loading or playing. Doesn't matter whether they are new or the ambient sounds from the mod I play, still using the original .pak files from 1997.

To Reproduce Steps to reproduce the behavior: Add ambient looping wind or mod sound effects to a map, only players with earlier versions of ezquake hear the sounds.

Expected behavior Expected behavior is that ambient sounds that loop in a 25-year-old game should work as they have for that long. Last version they work in is 3.2.3 AFAIK.

Screenshots Zipped cfg and screenshot attached.

looped config.zip

jkr4m3r avatar Dec 08 '24 21:12 jkr4m3r

I successfully produced some looping sounds by crafting wav headers like this a while back.

https://github.com/qw-ctf/ambiencefix

Think I just checked the vanilla id1 sounds and did the same thing. I did this to help out a fellow mapper who had working looping sounds in other engines that didn't loop in ezQuake. Think I found some 1990's software that was able to produce loops this way but it seems to be otherwise pretty dead. This approach however works just fine in both ezQuake as well as other engines so it solved my problem.

Might be that other engines support a less archaic version of loop headers that actively developed sound editors can produce.

But there has been a few changes to snd_mem.c since 3.2.3, you could always have a look at those and see if you find something if you don't want to use ambiencefix to generate cue headers.

This issue looks related, https://github.com/QW-Group/ezquake-source/issues/671

dsvensson avatar Dec 08 '24 21:12 dsvensson

you could always have a look at those and see if you find something if you don't want to use ambiencefix to generate cue headers.

I'm afraid that's way over my head! So is the ambiencefix thing... Win10 here Looked like Linux commands?

jkr4m3r avatar Dec 08 '24 21:12 jkr4m3r

Nah, it's go, so you can just build it from the command line if you have go installed, it's platform independent. But if you're not creating new stuff, it's less relevant. Nice to know that 3.2.3 worked. Devs around that time - that are gone now - seems to have replaced the playback mechanism, so very much a bug that someone needs to chase down.

dsvensson avatar Dec 08 '24 21:12 dsvensson

That's my point. I have no clue what "go" is. Not a developer. I tinker with weapon strengths in Quake C here and there and fiddle with maps for a certain mod, beyond that it's all over my head :P

jkr4m3r avatar Dec 08 '24 21:12 jkr4m3r

It's not. Any google search or AI prompt ought to be able to provide you with extremely simple step-by-step instructions on how to install go and compile a single go file without any prior knowledge. The question is more if you want to do it, or if you want to gamble on the bug being fixed. Don't build fake limits on what you can achieve, it's 2024, halfway to the future.

dsvensson avatar Dec 08 '24 22:12 dsvensson

I'm 65.

jkr4m3r avatar Dec 08 '24 22:12 jkr4m3r

Stop flexing with your infinite amount of spare time 😂

dsvensson avatar Dec 08 '24 23:12 dsvensson

That's the issue, always wondering why I got up and came into this room. I'll remember eventually.

jkr4m3r avatar Dec 08 '24 23:12 jkr4m3r

This issue looks related, #671

For sure related. In fact I checked this thread hoping it would be referenced. Would have to go back to pre https://github.com/QW-Group/ezquake-source/commit/95f4f98203be115994ef82fe12c8eb1cd6a31a5e (but not all the way to 3.2x - and rebuild without vcpkg, yuk !) to check playback. Would also need to procure the painkeep paks and figure out which ones are looped so someone can reproduce with them and see how different from #671 it is (if at all).

hemostx avatar Dec 17 '24 19:12 hemostx

All ambient sounds played fine in 3.2.3, is there some reason why this can't be fixed so they work in newer versions? Without having to redo the .wavs, I mean.

FWIW, I prefer 3.2.3 for various reasons, and will eventually move on to newer versions. But a couple of guys I play with are using 3.6.5 now and always see the errors in the console on map load and never hear the ambient sounds (which are cool in Painkeep).

jkr4m3r avatar Dec 17 '24 22:12 jkr4m3r

Dang, I assumed by now the recent ezquake builds would have fixed sounds. Am I being foolish to expect this issue to simply get fixed as ezquake progresses?

jkr4m3r avatar Jun 30 '25 19:06 jkr4m3r

Looping sounds work just fine, if you loop the same way as idSoftware did back in the day it works. I wrote a little utility to write the correct wav headers you can use. The headers it writes seems to work in all actively developed quake clients.

https://github.com/qw-ctf/ambiencefix

dsvensson avatar Jun 30 '25 19:06 dsvensson

Oh, already mentioned in thread. Anyways, use that or get someone to fix it.

dsvensson avatar Jun 30 '25 20:06 dsvensson

Thanks, way over my head, I was hoping the ezquake devs would include a pak with proper ambient sounds in newer builds. They haven't.

Also, when you say "if you loop the same way as idSoftware did back in the day it works", that sounds like my vanilla quake sounds in my original pak should be fine, but as far as I can see, they are broke. Am I missing something obvious here? (wouldnt be surprising)

jkr4m3r avatar Jun 30 '25 20:06 jkr4m3r

Dang, I assumed by now the recent ezquake builds would have fixed sounds. Am I being foolish to expect this issue to simply get fixed as ezquake progresses?

I think if it was widespread it would have been fixed by now.

But a couple of guys I play with are using 3.6.5 now and always see the errors in the console

I assume these errors are irrelevant, or they would have been posted here?

on map load and never hear the ambient sounds

Teleporters use looping sounds, and they play just fine, as does water, wind etc etc. Perhaps you have some weird files hiding in some pak/pk3 that override the idSoftware sounds?

This issue looks related, #671

Did you check that one?

that sounds like my vanilla quake sounds in my original pak should be fine

Is that the original pak file from the 90's, or the remastered version mentioned in #671?

dsvensson avatar Jul 01 '25 00:07 dsvensson

No remaster here, Many of the sounds that don't work are from the mod we play, but several of the original Id ambient sounds are "not looped".

Sound ambience/hum1.wav not looped Sound ambience/fire1.wav not looped

I'll take another look at your CTF fix and see if I can figure it out. I was hoping it was a code thing and everything would magically start working again eventually. I'm fine with staying on ezquake 3.2.3, but a couple other guys refuse to revert.

jkr4m3r avatar Jul 01 '25 13:07 jkr4m3r

It has nothing to do with CTF, it's just a github org I put the code under. They're right to avoid 3.2.3, it's horribly slow and remote exploitable in all sorts of ways. Sounds aren't CRC checked iirc so you can change them as you wish. I expect that anyone with zero computer skills will together with ChatGPT get the sounds looping using that utility in less than 20 minutes.

dsvensson avatar Jul 01 '25 17:07 dsvensson

fyi, certain (broken?) looping sounds don't work with the new sound system the way it is, if you compile with the old one they work. the new one had a bug where these particular sounds would lock up the entire client so a fix was thrown in to stop that from happening, but it should actually be fixed properly by someone who knows how that thing actually works (eg @eb).

see commit ea6b73479f68a2aab2dbf8dfbd36d54a180c6780

ciscon avatar Jul 01 '25 18:07 ciscon

Yea, I'm the type to DL the client and play, not a coder, couldn't compile ezquake, or anything, if my life depended on it. Waiting for the "proper fix" is my only solution I guess. No big deal, just got tired of the guys using newer builds complaining about console errors when they joined the server.

We play more than a few outdoor maps too, so the ambient wind sounds etc are not a big loss.

jkr4m3r avatar Jul 01 '25 18:07 jkr4m3r

Hi, I was testing the the newest 3.6.7 version and ran into this issue. We have a lot of maps using ambient (looped) sound for MegaTF, so I was trying to figure out how to get this fixed. A lot of my players are still using 3.2.3 where this issue was not present. I'm attaching a code snippet that did resolve the issue for me, but I am not a developer and this was from claude, however it seems to work 100%. I compiled ezquake with this code (only change was to snd_mem.c) which produced a working .exe for Windows and the warning/message for "sound not looped" went away and the sounds worked correctly. Can this code be checked by the devs and implemented and/or updated if something is not correct to fix the looped sound issue?

` } else { // Fallback: if new method fails, try simple cue point detection // This handles basic cue chunks without complex LIST structures loopstart = sfcues.cue_points[0].sample_offset; if (loopstart >= 0 && loopstart < sfinfo.frames) { // Set loop to play from cue point to end of file // This is a simple but effective fallback for basic looped sounds Com_DPrintf("Using fallback loop detection for %s\n", s->name); } else { // If even the simple fallback fails, try the old WAV parsing method // This is a last resort for compatibility with older loop formats Com_DPrintf("Trying old WAV parsing method for %s\n", s->name); loopstart = -1; // Will be set by old method if successful } } }

sf_close(sndfile);

// If the new method failed to detect a loop, try a simple fallback
if (loopstart == -1 && cue_count > 0) {
	Com_DPrintf("New method failed, trying simple fallback for %s\n", s->name);
	
	// Simple fallback: use the first cue point as loop start
	// This handles basic cue chunks without complex LIST structures
	loopstart = sfcues.cue_points[0].sample_offset;
	if (loopstart >= 0 && loopstart < sfinfo.frames) {
		Com_DPrintf("Fallback found loop at %d for %s\n", loopstart, s->name);
	} else {
		// Last resort: try to find a basic cue chunk manually
		Com_DPrintf("Trying manual cue chunk parsing for %s\n", s->name);
		loopstart = -1;
		
		// Look for 'cue ' chunk in the WAV data
		unsigned char *cue_pos = NULL;
		int i;
		for (i = 0; i < filesize - 4; i++) {
			if (memcmp(data + i, "cue ", 4) == 0) {
				cue_pos = data + i;
				break;
			}
		}
		if (cue_pos && (cue_pos - data + 32) < filesize) {
			// Read cue chunk data (simplified parsing)
			unsigned int cue_size = BuffLittleLong(cue_pos + 4);
			if (cue_size >= 24) { // Minimum size for one cue point
				unsigned int num_cues = BuffLittleLong(cue_pos + 8);
				if (num_cues > 0) {
					// Get the first cue point position
					unsigned int cue_position = BuffLittleLong(cue_pos + 20);
					loopstart = (int)cue_position;
					Com_DPrintf("Manual parsing found loop at %d for %s\n", loopstart, s->name);
				}
			}
		}
	}
}`
Image

teckademics avatar Oct 12 '25 19:10 teckademics

i can verify this works without any obvious side effects. it'd be nice for someone else to take a look that has actually dealt with looping sounds beyond a quick hack to keep it from an infinite loop as this is my only experience with it ;)

ciscon avatar Oct 12 '25 21:10 ciscon