GZDoom 3.x sound issue with Fraps

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE/EDuke32/Raze? Did your computer break? Ask here.

Moderator: GZDoom Developers

Forum rules
Contrary to popular belief, we are not all-knowing-all-seeing magical beings!

If you want help you're going to have to provide lots of info. Like what is your hardware, what is your operating system, what version of GZDoom/LZDoom/whatever you're using, what mods you're loading, how you're loading it, what you've already tried for fixing the problem, and anything else that is even remotely relevant to the problem.

We can't magically figure out what it is if you're going to be vague, and if we feel like you're just wasting our time with guessing games we will act like that's what you're really doing and won't help you.
Post Reply
User avatar
Facínora
Posts: 109
Joined: Fri Sep 18, 2015 5:46 pm
Contact:

GZDoom 3.x sound issue with Fraps

Post by Facínora »

I'm having a sound issue when trying to record videos from GZDoom 3.x with Fraps. It gets "popping", like when you are trying to play really loud music in a really weak sound system.

This video features the same clip of a replay, recorded first with Camtasia (that captures the sound ok but drops the fps rate a lot) and then with Fraps. I made it in order to show the problem if someone has a solution for it, but no luck so far. Then, I decided to ask for help here. I hope its ok.

Camtasia is really bad for me to record GZDoom videos or replays, Fraps is kinda lighter and I don't have money to buy a new PC yet. Nvidia's ShadowPlay or that built-in Windows 10 recorder don't support my machine.

So far, I could manage to record the sound separatelly with Audacity and sincronizing before editing the videos, but its not the perfect solution even being cheaper than buying the new Dxtory version (which I don't know if will record videos with a decent quality here yet)... I know that fraps is an old software and maybe nobody else cares (perhaps except DBThanatos) but maybe this sound issue has more implications than it.
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: GZDoom 3.x sound issue with Fraps

Post by Chris »

Almost sounds like FRAPS is getting the floating-point audio samples and converting them to integer without proper clamping, causing the amplitude values to wrap which creates that kind of static. Considering you say it's not an issue with Camtasia or Audacity, that suggests it's an issue with FRAPS. I'd be curious if there's a similar issue with other apps that play floating-point samples that can be outside the -1...+1 amplitude range.

If you're interested in checking out alternative video capture solutions, perhaps give OBS a shot. It's mostly used for streaming, but does plain recording just fine. I don't know what its performance is like relative to those other things, but there's no harm in trying.
User avatar
Facínora
Posts: 109
Joined: Fri Sep 18, 2015 5:46 pm
Contact:

Re: GZDoom 3.x sound issue with Fraps

Post by Facínora »

Chris wrote:Almost sounds like FRAPS is getting the floating-point audio samples and converting them to integer without proper clamping, causing the amplitude values to wrap which creates that kind of static.
this kind of info is kinda fascinating, even though it sounds like greek to me. is it related to the sound waves we see when editing audio?

Anyway, yes. I think it's a FRAPS issue, but it could capture sounds properly before GZDoom 3. Maybe there is something to do with OpenAL, I don't know.

I have OBS installed here, as it was suggested in some other threads here as well, but I still didn't manage to config it properly. I get horrible fps rates and it even lags the game itself...
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: GZDoom 3.x sound issue with Fraps

Post by Chris »

Facínora wrote:this kind of info is kinda fascinating, even though it sounds like greek to me. is it related to the sound waves we see when editing audio?
Basically, yeah. Audio samples use a normalized range which have minimum and maximum possible amplitude values. For 16-bit samples, this is -32768 (the lowest point of a sound wave) to +32767 (the highest point of a sound wave) which is the limits of a signed 16-bit value. For floating point, the normalized range is -1 to +1 (this covers the same "loudness", it's just a different value scale; simply multiply by 32767 or 32768 to get 16-bit sample values). A feature of floating point samples is that they can go outside its normalized range temporarily, so when doing various audio processing tasks you don't need to worry about clipping or wrapping before the mix is done. Internally, most audio mixers use floating point for that reason.

The issue arises if you have floating point samples being converted to 16-bit, and you don't properly account for them being outside the normalized -1 to +1 range. For example, if you have a floating point sample value of +1.01, multiplying by 32767 would give you an integer value of +33094. That's larger than the maximum 16-bit value (32767), so it wraps around and becomes -32442. That's very different from the intended amplitude value, resulting in very audible noise. A more correct approach would be to clamp it to 32767 -- it would still be different than intended, but the noise would be far more subtle (other options include applying gain compression, dynamically reducing the volume around loud noises to prevent large sample values like that). So what could happen is, the game gives floating point samples to the system that are outside the normalized range, FRAPS opens a "read-back" capture device on the system to get the floating point samples being played on the device, and improperly converts them to 16-bit when compressing the audio stream.
Anyway, yes. I think it's a FRAPS issue, but it could capture sounds properly before GZDoom 3. Maybe there is something to do with OpenAL, I don't know.
Probably. By default, OpenAL Soft will output floating point samples if the system will accept them, with the expectation that the system's audio layer may do further processing (mixing sounds from another app, system-level volume control, filtering or some kind of compression, etc) in which case it's best to avoid clamping before the system is done with it (and even if it doesn't do any more processing, there's little harm in letting the system do the float->integer conversion since it's being done regardless). FMOD probably defaults to 16-bit output, implicitly clamping its output to the normalized range before the system (and thus FRAPS) gets it, which is why it didn't happen before.
User avatar
Facínora
Posts: 109
Joined: Fri Sep 18, 2015 5:46 pm
Contact:

Re: GZDoom 3.x sound issue with Fraps

Post by Facínora »

So the math fraps doing is wrong and thats what is distorting the sound it captures? I didn't know if I should address to this problem here, because I didn't think anybody would care, but this is kind of information is so cool that surelly made it worth while.

Anyway, is there any chance of a fallback in the next versions or that would make GZDoom unjustifiable heavier, conflict with its other audio functions etc?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GZDoom 3.x sound issue with Fraps

Post by Graf Zahl »

FMod was removed because its license is essentially poison and maintaining it is a hassle. It won't come back.
User avatar
Facínora
Posts: 109
Joined: Fri Sep 18, 2015 5:46 pm
Contact:

Re: GZDoom 3.x sound issue with Fraps

Post by Facínora »

Graf Zahl wrote:FMod was removed because its license is essentially poison and maintaining it is a hassle. It won't come back.
I totally understand that. Anyway, it would be very good if there is some other way to prevent this from happening.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GZDoom 3.x sound issue with Fraps

Post by Graf Zahl »

You'll have to ask the Fraps developers for that. What good is a tool that cannot handle a common sound format that's only going to see wider use in the future?
User avatar
Facínora
Posts: 109
Joined: Fri Sep 18, 2015 5:46 pm
Contact:

Re: GZDoom 3.x sound issue with Fraps

Post by Facínora »

Graf Zahl wrote:You'll have to ask the Fraps developers for that. What good is a tool that cannot handle a common sound format that's only going to see wider use in the future?
it should good for people who have old hardware and no money to buy new gear nor softwares, specially in countries where the government rips us off more than the usual when purchasing this kind of stuff...

Anyway thank you for the attention and the info. It's really quite interesting.
Post Reply

Return to “Technical Issues”