HDR sound?

Started by
19 comments, last by Prune 16 years ago
I really think that there exists HDR sound, like HDR lighting, but i have not found any hardware or API that supports it. Do you know any? Or do i have to do it manually? If so, how (with directsound preferably)?
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
Advertisement
Sound on a CD uses 16-bit samples (at ~44100 samples per second).

Single precision HDR imaging uses 16-bit colour channels.

Therefore consumer-grade sound was of high range long before consumer-grade visualization.
Actually, most sound cards sold today can output at least 24-bit 96kHz signal. AFAIK professional sound cards can even use 32-bit floating point; professional sound mixing applications generally support this format for its convenience regarding filter implementation and flexible range. However, most real-time mixers do not need higher bit-depths than 24 because it is difficult or impossible for the listener to notice any improvements beyond that, and the sound author has already done the pre-mixing which does require higher precision.

Some sound APIs (such as DirectSound) allow you to configure the sample rate and bit depth programmatically. In creating your sound buffers, set the members of the associated DSBUFFERDESC structure appropriately to request buffers with desired sample rates and bit depths.

Niko Suni

Yes, i know its 16-24 bit, i do use 16 bit sound, but i was talking about automatic dynamic volume, sorry.
So is there some way to automatically adjust the sound volume depending on the current enviroment (louder where there are only birds singing, and softer when a bomb explodes near you), so you will always hear footsteps and wont get deaf when loud sounds come in.
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
HDR in graphics is not automatic either; the programmer generally finds black, midpoint and white values from the high-range color data and adjusts the final brightness transfer function accordingly.

It is very common in games to set the master sound pressure according to the loudest possible sounds in a given scene. This is equivalent to evaluating the white point in graphics and mapping the maximum scene brightness to correspond with that of the display system.

Niko Suni

And how do i do it? Simply lock the primrary buffer, read out data and adjust the volume? This is pretty much straightforward, but is it efficient enough?
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
Generally, you know in advance how loud your samples are. In a game scenario, you should store your samples in normalized (full) volume but set the playback volume of the samples as properties of your "actors".

If you want to adjust the general sound volume in a 3d environment, just sort your sound-generating objects by (1/distance*maximum loudness) to find the maximum audible volume and use it to multiply the master volume. You don't even have to actually sort anything, just take the maximum value of the above equation across your objects.

This is equivalent to a simple white-point compensation in graphics.

Niko Suni

Gagyi, if I understand your original post correctly, this is an idea that I've had as well. In real life the sound of footsteps (for example) is much, much quieter than the sound of a gun firing. In a game, if you put these two sounds at their correct relative volumes, and made sure that the gun sound wasn't overly loud (i.e., no clipping distortion), then you'd have to make the footsteps be so incredibly quiet that the user would never hear them. Instead, it makes sense to me to use a dynamic audio compression algorithm to increase the volume of the footsteps and other quiet sounds when there are no loud sounds present, but fade them back down to a low level when loud sounds are present. I don't know anything about DirectX, but I think all this would require is:
1) set the gains on all of your sound samples to realistic relative volums (if gun sounds are a gain of 1.0, then footsteps should use a much, much smaller gain)
2) on the mixed audio output, run a dynamic range compression algorithm (this is equivalent to your tone mapping in visual HDR)

http://en.wikipedia.org/wiki/Audio_level_compression

EDIT: Nik02's post above is a simpler way to do #2 above that doesn't require the overhead of running an algorithm on the mixed audio output
Fire up Half-Life 2, drop a grenade next to your feet.

All sound quietens, except a high-pitched whine in your ears. You gradually regain you hearing after a few seconds.

This what you mean?

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

Quote:Original post by deadstar
Fire up Half-Life 2, drop a grenade next to your feet.

All sound quietens, except a high-pitched whine in your ears. You gradually regain you hearing after a few seconds.

This what you mean?


Yes, kinda, but a bit faster hearing regaining :)

Quote:
If you want to adjust the general sound volume in a 3d environment, just sort your sound-generating objects by (1/distance*maximum loudness) to find the maximum audible volume and use it to multiply the master volume...


I thought getting the primrary sound buffer's content (after the 3D and mixing stuff) somehow, and then adjusting the volume is easy, but this is just as easy and much faster i guess. Thanks for helping :)

BTW, isn't it 1/distance^2? or 1/distance^Rolloff factor?
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)

This topic is closed to new replies.

Advertisement