Announcement

Collapse
No announcement yet.

Warped Sound effects under water?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Warped Sound effects under water?

    Is it possible to make the sound effects distorted and down pitched underwater? That was an excellent thing about Duke3D and build that made underwater fights really cool.

  • #2
    Definitely possible, but unless there's an effects unit built into the engine it will eat quite some memory and require lots of duplicated sounds.

    Weapon, player, item pickup, all monster sounds... that's a ton of extra sounds we're talking about.

    FX in the engine woud be neat and could probably be done with LADSPA plugins which are mostly under the GPL, but it would also eat processing power and drag the performance down.

    Maybe there's an easier (and crappier) way.
    Scout's Journey
    Rune of Earth Magic

    Comment


    • #3
      A somewhat crappy but not completely hacky way would be:

      Code:
       // gl_misc.c
      
      qbool Is_In_Water;
      void R_SetupView (void)
      {
      ...
      	int contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents;
      
      	// If we are in water or slime or lava
      	// Save that info so we can distort the sound
      	// When playing it so set Is_In_Water to true or false
      
      	// Based on the contents you are in.
      	Is_In_Water = (contents == CONTENTS_WATER || contents == CONTENTS_SLIME || contents == CONTENTS_LAVA);
      }
      Then in the play sound stuff is Is_In_Water is true, maybe borrow some of sound modification stuff from Engoo (the software Quake engine) Engoo

      This would keep the QuakeC and the server out of the mix and minimize modification.
      Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

      So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

      Comment


      • #4
        Much depends on the engine's sound processing ability.

        Unless your engine incorporates half of Cubase or the like, dedicated wav files will give you better quality.

        Also, distortion is what you do with guitars in heavy metal music, for an underwater effect you'll probably want pitch shifting and something like a phaser or rotovibe.
        Scout's Journey
        Rune of Earth Magic

        Comment


        • #5
          Detecting if the player is underwater is a little more complex than that - if the mapper has used bmodels for water volumes they won't have contents flags, for example.

          DirectSound has some nice looking effects that should be able to do something here, but I could never get them working and could never find some sample code that would port. Of course, it needs DirectSound too.
          IT LIVES! http://directq.blogspot.com/

          Comment


          • #6
            I opened up Audacity and loaded up gb_chopper.wav

            Converted the audio bitrate to 8000 Hz.

            It sounded all muzzled and hard to hear. Maybe useful technique that I saw Googling around for C code (yeah the common answer to underwater in Google was "resample to low bitrate" of all things ... ).

            Ironically, this could probably be done rather engine on the engine side. I'm not advocating an engine solution. I'm just saying that if the above is the best way to achieve the effect ...

            snd_mem.c already does this ... (!!)
            Code:
            void ResampleSfx (sfx_t *sfx, const int inrate, const int inwidth, byte *data)
            {
            	sfxcache_t	*sc = Cache_Check (&sfx->cache);
            	
            	if (!sc)
            Originally posted by MH View Post
            Detecting if the player is underwater is a little more complex than that - if the mapper has used bmodels for water volumes they won't have contents flags, for example.
            Yeah, I know you guys did that Shove extra EF_FLAG onto view ent to tell client they are underwater, hehehe ....
            Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

            So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

            Comment


            • #7
              Hello,

              I hope Baker will not shoot me in my back with his shotgun, but I think that a basic *feel* of what Bloodshoot is requesting can be done via a simple QC change.

              First thing we learned from gb is:
              Dedicated .wav files are a good idea.
              So I understand that we can modify the standard sounds with a music editor (like Audacity) to make them sound like beeing underwater and save them in a seperate file name.

              Then we add a check before all sound calls, like this example, taken from void() ammo_touch =
              if (other.waterlevel == 3)
              sound (other, CHAN_ITEM, "weapons/shotgn2.wav", 1, ATTN_NORM);
              else
              sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);

              And call the edited sound files when we are underwater.

              I just tested it, and Quake plays the shotgun sound just fine when I am completely under water.
              So it also can play the edited "lock4.wav" sound (which we edited with audacity before) to make it sound water-ish.

              Other sound (from weapon sounds for example) can be added the same way (just replace "other" with "self" if needed in the code).

              I know, this is a simple and maybe an idiotic way of doing it, but as a first impression (and depending on your Audacity edit skills) it can be quite effective.

              Again, it was just a simple idea, please dont shoot me in the back

              Best wishes,
              Seven

              Comment


              • #8
                I don't think dedicated WAV files are the way to go with this actually.

                The way that sound works in the engine is that it takes the raw WAV data and then writes it to a streaming circular buffer, so an obvious place to inject some funky stuff is at the point of the write to the buffer. A lookup table during the write may be all that's needed here.

                A way to control this better from QC would be cool of course, but there's probably no harm in having some default FX hard-coded into the engine that QC can override or that the player can switch on/off.

                DirectSound includes Flange, Gargle, Environmental Reverb and Echo effects that seem like they could give a nice result; they require you to use the DS8 interfaces (not too hard - just use the correct Create function and QueryInterface your buffer for the DS8 interface, then release the original). Could never get the effects to work properly though.

                The big weakness is that Quake's worlds are actually very quiet. There's not much going on sound-wise to begin with - just a few crackling torches, the occasional faint hum and other than that it's almost nothing (aside from the action).
                IT LIVES! http://directq.blogspot.com/

                Comment


                • #9
                  I of course agree with you MH.
                  The possibilities for engine driven sound effects are of course much bigger.
                  But which engine does it today ?
                  A possibility via QC would be engine independent and maybe therefore a "better" way.

                  And yes, Quake is silent...
                  But fortunately we have the "skill 3" setting, so that we dont fall asleep

                  Anyhow, a very good idea from Bloodshot !

                  Comment


                  • #10
                    Darkplaces has a new built in called: sndpitch (?) that will do this to any sound via the QC.

                    Comment


                    • #11
                      QC can't really do it at all though. It doesn't have access to the wave data or sound hardware and also it runs on the server whereas sound runs on the client - instant break in multiplayer. So something needs to be done engine-side initially, with an optional QC interface made for it for use by mods.
                      IT LIVES! http://directq.blogspot.com/

                      Comment


                      • #12
                        tbh as a modder I would prefer the brute force wav file / qc approach, since I don't believe a Quake engine can do the same as an audio editing software / plugins.

                        All this talk about sample rate (ugh) and a couple DirectSound presets (ugh, and windows only) doesn't convince me that it could beat Audacity, Cubase and friends.

                        While a wav file is not limited at all in what a content designer can do with it, is crossplatform, and you can use external software to create your sounds. I remain skeptical that any game engine can beat that.

                        RMQ already uses different weapon sounds while enraged, and other games use different footsteps depending on surface, and all this is usually done via extra wav files and not via realtime sound effects. Underwater stuff is just more of the same. Maybe we're overthinking it.
                        Scout's Journey
                        Rune of Earth Magic

                        Comment

                        Working...
                        X