Sunday, September 18, 2011

DirectQ Update - 18th September 2011

I've dropped support for 8-bit sound from DirectQ; sounds are now upsampled to 16-bit at load time and all further sound processing is 16-bit all the way. I've also removed the upper limit (was 512) on the number of sounds that may be loaded.

This is something of a prelude to a more general cleanup of the sound code overall.

So, a few things have gotten cleaner as a result of this, but there was a (very) slight drop in performance and increase in memory usage. That's something I'm prepared to accept; I hope to address the performance drop over time, and memory is a cheap and plentiful resource that is there to be used.

When I say "increase in memory usage" by the way, I don't mean in the order of 10s or 100s of MB. It'll be a few MB, absolute max.

The 8-bit sound mode really only existed in Quake for low memory machines (and we're talking "low memory" relative to 1996 specs here) which - in some cases - would even resample 16-bit sounds down to 8-bit. Nasty. In 2011 we don't have to worry about this kind of thing.

What's interesting is that the overall quality of sound seems to have improved a little. Sounds are a little crisper, but without loss of any crucial low frequency ooomph.

This naturally brings me on to 44k sound, etc. DirectQ actually mixes sound at 44k, but the source sounds are still at the lower original rate. -sndspeed, -sspeed, etc are all present and you can use them to upsample the source sound rate, but the important thing to note with these options is that they actually decrease your sound quality quite considerably. You're not actually getting higher frequencies, you're getting smeared and pitch-shifted sound instead.

When I do move to a fully native DirectSound implementation I expect this to blow up a little. The entire mixer will be fully and natively running at 44k (or sometimes 48k) but an 11k source sound will remain that - 11k. Because with digital audio once you remove something that's it - it's gone forever. Those higher frequencies just cannot be brought back.

That should be both interesting and fun...

8 comments:

Unknown said...

We should see if we can get a hold of Trent Reznor and whoever else worked on the sounds to ask about getting CD quality sound effects

gur said...

@Unknown: Some of the sounds can be found in high quality from "Sound Ideas Series 6000 "The General" Sound Effects Library", I have found a few actually, but there are a lot of sound effects in there to sort out..


Why not go with XAudio2 (should work with Windows XP and up) instead of DirectSound? It seems to be the new DirectSound..

Also does DirectQ use Raw Input for the mouse input or just the ordinary DirectInput? It would be nice to see Raw Input if it doesn't. As I understand it should be lower latency (probably not noticeable, but it would still feel better) then DI.
Other games like Quake Live, ezQuake and Team Fortress 2 use it for example..

mhquake said...

It used raw input up until the last release, when it switched back to DirectInput. Reason why was there were some quite severe input latency bugs (ironically) with it's raw input implementation and switching back to DirectInput made them go away.

On a modern PC DirectInput is just a wrapper for raw input anyway.

mhquake said...

Oh, and on sound...

I've looked at XAudio and the API is really not that much different from DirectSound. The big advantage of DirectSound for me is that it's much less disruptive to the code.

I've also rejected other audio APIs for similar reasons to why other BSP formats were rejected: too disruptive.

Ron Jones said...

We should see if we can get a hold of Trent Reznor and whoever else worked on the sounds to ask about getting CD quality sound effects

Try sending an email about it to Christian Antkow and CCing it to Todd Hollenshead. Contacting Reznor will probably get you nowhere, but you may have some luck going through Christian and/or Todd.

mhquake said...

I'm not too bothered about the effects to be honest; I don't really position DirectQ as a "high quality content replacement engine" (I even have regrets about ever including external texture support). Maybe some of the guys working on DP mods over at quakeone.com would be better people to chase that one up?

K-Kaden said...

I'm not saying we need high quality sound effects, just that it'd be a waste of the DSound resource we'll have to work with, 11khz sounds when we can use 44

Ron Jones said...

If you're looking for higher-quality effects for Quake, take a look at the Mindgrid audio pack. And send an email to Christian — it really couldn't hurt anything to explore that possibility.