AVLS 3rd party software?

D619d95cddb1edb227f51ef539d15cdc
0
Nautilus 103 Mar 12, 2012 at 15:55

Hello.

Does anybody know of a software that limits the audio output of a given source in case it peaks past a given threshold?

Talking of an AVLS (Automatic Volume Limiter System), just like those you find on some expensive headphones (which I don’t have). But this is for Windows. Or for games. I’d write one myself, but I know no klutz of audio programming.

I have an old game that, um, politely now… oh heck, it *SUCKS* at controlling its own audio output may its programmers sneeze violently right now it’s is the least they deserve for letting such foul thing go into production… oh! sorry - I got carried away.
But to think that it was patched twice(!), come on.

Whatever the cause of it I don’t care. But at the bare minimum volume level, the game will *BBBOOOOM!!!* my speakers (and my ears) off if I detonate a cluster of explosive barrels… whereas if I find a lone barrel to blast it will be a gentle and educated ‘pum’, perfectly in tune with the rest of the audio experience.

Somebody, help?

7 Replies

Please log in or register to post a reply.

D619d95cddb1edb227f51ef539d15cdc
0
Nautilus 103 Mar 12, 2012 at 22:49

Not sure whether I should be partially happy or partially unhappy.

After a long fruitless search I conclude that there’s no such software around. The problem seems to be that this is pretty much “unexplored land”, “a wanted grey zone”, “stuff not happily spoken of”, “poorly documented”, “this page intentionally left blank”, “eh?”…
Long story short: it can be done but they won’t tell you how. Badmouths say that this is lobbies’ doing. You know, DRM?

I have no problem with that. My quest is different. And my problem stands unsolved. So…
Doing other searches I pieced together enough knowledge to do something normally disallowed (sAPO and WinXP aren’t on the same rail, so don’t go there - thanks). Since the exploits coming from it are huge, I’ll say that I can nose into an audio stream before it reaches the speakers -what I care about-, but how I get to do that is dying with me, period.

This means that I can alter the audio soon to be heard. I’m exactly where an AVLS should be.
Score, baby! \^_\^ … or not? :mellow:
I’m just as ignorant on audio programming as I was this afternoon. And this sounds more like audio stream real time post-processing. As if I know what’s what. How do I tell if the submitted data is going to roof throught my desired volume cap? And how do I manipulate it to lower its volume? I don’t even know how I should keyword a search for this.

Input, please?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 13, 2012 at 00:17

You can calculate the power of a signal by averaging the squared amplitudes over some short range of time, like a few milliseconds. (The amplitudes are the numbers in the audio stream; I assume you already the audio stream’s sample rate and format, and how to pick apart the stereo channels, etc.) Anyway, average power is a reasonable proxy for perceived loudness, although they’re not quite the same thing.

You could process the stream in blocks of a few milliseconds, calculate the power of each, and if it exceeds your set maximum, scale all the amplitude values to reduce the power back to the maximum. Since power is the square of amplitude, you’d want to scale by sqrt(maxPower / curPower).

I haven’t tried this so it may produce issues like audible pops, and it might add noticable latency (delay) if you use blocks that are too large. Anyway, it’s a possible starting point.

D619d95cddb1edb227f51ef539d15cdc
0
Nautilus 103 Mar 13, 2012 at 16:15

@Reedbeta

Anyway, it’s a possible starting point.

That’s anyday better than having no starting point at all :)
Thanks for the input. I’ll see to get something good out of it. This is rapidly becoming a matter of principle.

Luckily I have the exact specs of the sounds, as they sit in a subfolder of the game root, in form of individual *.wav files. They are all: Wave, Unsigned, 8 bit, Mono, 11025 Hz.

I’ll be no expert, but something smells odd here.
Their quality is too poor a choice for a game released in 2000. All the 117 sound files together make less than 13 MB on disk. If I inspect the CD-ROM… there is no copy protection, compressed data for 539 MB, and a single CD Audio track (7m 01s) worth \~72264000 Bytes. All considered the CD is \~636 MB.
There *was* room for better sounds. Or a lot more room if they opted for a 700 MB CD.
Also, by listening to the sound files, most of them ‘clip’ (if I use the term correctly). Some do it badly.

This is no work you expect from professionals. I get the impression that the game was rushed, and the devs had no time to refine their audio. That might explain some things. Only… I cannot find the Publisher’s name. It is nowhere. Not in the opening FMV, not in the Readme, ~~not even online. There’s only the Developer’s name. I’m puzzled, if the game was indeed rushed, then, who did it?~~ [edit: nevermind. Found it]

But rushed or not it’s unforgivable that in two patches the devs haven’t addressed the problem I described in the opening post. It is really *that* bad, and makes you want to uninstall and forget about it.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Mar 14, 2012 at 11:04

What is probably happening is they haven’t got any code in the game to limit the number of instances of a sound effect being played.

So if you shoot one barrel, you hear the sound effect once, if you shoot 20, it plays the sound effect 20 times.

Pretty basic error, but one that was all too common.

To get around it without access to the games source code is very tricky. Simply modifying the sound effects on disc won’t help.

As far as I can see there are two options.

1) Hack the game

This is not a task for an amateur. Would be a really interesting thing to do as a learning process though. A circa 2000 game should be easy to load in something like win32dasm. Then look for the calls to the sound api and work out where they are playing the sound effects. Find a few bytes of spare memory and drop your own code into this space using machine code and a hex editor.

Can be done, I used to do it all the time for a company called Freeloader, but by no means easy. :D

2) Change the sound drivers on your machine

Also not easy. I don’t know what sound card you are using, but regardless I very much doubt you have access to the source code for it.
I haven’t written any win32 sound drivers, so I’m not sure if you can get a generic sound driver that will work with your sound card, but I think it’s probably your best bet.

Sound programming is one of the areas that I think has been down rated in games coding. There are hundreds of ways of processing a triangle list into beautiful on screen graphics, but very few ways of turning wav files into nice sounds.

Even Final Fantasy XIII 2, or whatever random code the current version is, suffers from this. This is one of the only games that has ever made me want to jam a pencil into my ears and press REALLY hard. To make matters worse, they didn’t even put in a volume control for the god awful music. If I tried to release a XNA game without a music volume control it would fail peer review, but Square can do it.

annoying.

D619d95cddb1edb227f51ef539d15cdc
0
Nautilus 103 Mar 14, 2012 at 16:59

@Stainless

What is probably happening is they haven’t got any code in the game to limit the number of instances of a sound effect being played.

So if you shoot one barrel, you hear the sound effect once, if you shoot 20, it plays the sound effect 20 times.

Pretty basic error, but one that was all too common.

You hit the nail right on. With an audio editor I mix together 4 instances of the same explosion effect, and the result is the unholy thing heard in game upon detonating a cluster of 4 barrels.
I can’t believe they allowed for it. It’s an issue you meet like at minute 8 into the training level and there’s no avoiding it. What do I have to believe? That they haven’t playtested past the 7th minute? Or that they turned a deaf ear to it?

My skills don’t allow me to hack into the exe and change things like you suggest.
And I see that, in DirectSound, the sounds to be played are first stuffed in a buffer then the buffer is played. Much like batching and drawing primitives in a VertexBuffer. I’d find no convenient isolated sound data to mess with anyway.

The AVLS remains the easier solution - though certainly not the most elegant.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Mar 16, 2012 at 10:34

The problem often is in the test environment, and commercial pressure put on the QA team.

A hell of a lot of AAA games wouldn’t have been passed for duplication if I had been in charge of QA. :D

Imagine you have a room full of game testers, and they all have a nice sound setup, with multiple speakers, sub-woofers, etc. Walking into the test room without earmuffs would result in deafness and a court case.

The other problem I have had is advertising. A double page spread in a computer magazine can cost unbelievable amounts of money, think of a number, double it, add your telephone number, and print it on a rate card seems to be the pricing policy. On top of that the advertising space has to be booked months in advance. Some times you get to the predicted release date and you still have a bug list. It depends on what sort of company you work for then, some put it out anyway and release a patch shortly afterwards. Others delay the launch.

One game I worked on (that will remain nameless) was advertised as having 100 levels, when we tried to master it we only had room on disk for 99. We tried a lot of tricks to free up some space, but couldn’t quite get the last level on. So we made level 99 loop, impossible to complete.

Naughty. :P

I will ask a friend of mine who is into sound programming if he fancies writing a AVLS system, I’ll let you know.

D619d95cddb1edb227f51ef539d15cdc
0
Nautilus 103 Apr 01, 2012 at 17:10

[Server] You are now in a no PVP area.
PAUSED
UNPAUSED
Nautilus is casting Thread Resume
Nautiluscasts Thread Resume
AVLS 3rd party software? : Will Save vs. Reply : *failure* : (11 + 18 = 29 vs. DC 34)
Nautilus appends to AVLS 3rd party software?: 1 (1 post)
Nautilusresumed AVLS 3rd party software?

\^\^ Nice excuse to intro a resume : )
(the colors are accurate, btw)

It’s done and it’s over. And it doesn’t work nicely. I did all I could. Now I’m tired and will move on. But it was worth a try, even if it’s been a losing battle.
As a last attempt I did even remaster all the game’s sounds, upsampling them, making them stereo, cleaning up the hiss, removing pops and clicks, reduding the clippings, uniforming their volumes. A labor of love, just to see if it’d work.
The result was a mess of sounds gone quasi-mute while other sounds (looping environmentals, mostly) have risen in volume to the point that they cover everything else. The reason for it? I dunno. Could have something to do with the original problem of the explosion effects ‘summing’ up. But it still makes no sense. My new sounds are fine and their quality is an Everest above the game’s ones.

This game (which will remain nameless) was born under a bad star. Its audio department is a total failure. So sorry. I wanted to play it just once and finish it, even if it’s no masterpiece, even if it had an absent plot, even if the GUI is uninspiring, even if there’s no variety in textures and the environments are all the same… The gameplay is interesting.
To think that I had it shipped from the UK – “finally found it”, I said to myself. It’ll remain a pretty CD-ROM I can’t enjoy.