Jump to content
  • Advertisement
Sign in to follow this  
Gagyi

HDR sound?

This topic is 3762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!