XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

Need help making a ambient background in XACT

Last post 9/28/2007 6:02 PM by Scott Selfon. 6 replies.
  • 9/12/2007 12:36 AM

    Need help making a ambient background in XACT

    So I have a few wavs that need to mesh together into a ambient background.  I have all of them in a sound bank and need water running constantly and then birds coming in every 5 minutes or so - I also have flies and wind that will need to float in and out

    whats the best way to do this? The documentation is not helping

  • 9/16/2007 4:03 PM In reply to

    Re: Need help making a ambient background in XACT

    Hi there,

    There are a couple of possible ways to do this -- using a single cue (for instance, named "MyAmbience") or multiple cues ("BackgroundAmbience", "Birds", "Flies", and whatever other cue names you want triggered). For the former, the programmer would trigger it once; for the latter, the programmer would fire off the base ambience and then also the foreground elements separately and recurrently.

    As to the structure of the cue(s), they would likely each have a single sound. If you're using a single cue, you'd have one track with a looping play wave event (the loop property is available globally on the sound by selecting it in the sound bank, or per play wave event by selecting any of them) firing off your background ambience. You'd then use other tracks for the other elements (birds, flies, etc.). For each of these, since we want randomized timing, note that there are a pair of properties that will be of interest -- "Time Stamp" and "Random Offset". The first tells the event when the earliest is that it can be triggered, and the second says how far from that time it might be triggered. For instance, if you wanted to wait up to five minutes, but a minimum of 2 minutes between triggers, you might set Time Stamp to be 120 sec (2 min), and Random Offset to be 180 sec (3 min). The wave will then fire between 2 and 5 minutes from now.

    Here's the rub with this cool randomized timing functionality -- currently it only works on the play wave event itself, not on any subsequent loops. When the sound (or specific track) starts to play, it'll wait as defined above, but if you then loop the track, the next variation will be chosen immediately after this one completes, with no delay/silence. A workaround is to have silent waves of variable lengths as variations [XMA compression keeps silent waves tiny on Xbox 360; on Windows, they can similarly be tiny by generating them at very low sampling rates], though this of course introduces its own potential issues (the engine might randomly choose silent variations too frequently, or not frequently enough, etc.). Another alternative is to use the multiple cues described above -- the programmer listens for the notifications relating to the cue, and when the chosen wave completes, the programmer fires off another instance of the cue (which again waits for time stamp+random offset amount of time before firing another instance).

    Hope this helps a bit!

    -Scott

  • 9/17/2007 1:28 PM In reply to

    Re: Need help making a ambient background in XACT

    Thanks Scott. well I have the water looping nicely and wind, birds1 and birds2 coming in randomly using the time stamp/offset feature.  The problem I run into now is that the non-looped wavs are only playing once!  Is there a setting for number of plays or do they play occasionaly by default?

    I have all of this in a sound bank called "ambient day"with each WAV with it's own play wav event.  I then dragged the sound bank down to a new cue called "ambient day"

    P.S. I barely missed you at the Austin GDC....I was talking to someone at the Microsoft booth who referred me to you.  I became consumed in the madness and lost focus :)

     

    www.myspace.com/noisebuffet

     

  • 9/17/2007 3:59 PM In reply to

    Re: Need help making a ambient background in XACT

    If you are using a cue set loopevent=infinite for infinite looping.

    HTH

    David.
    DCProven
  • 9/18/2007 6:29 PM In reply to

    Re: Need help making a ambient background in XACT

    So each play wave event has its own loop property; when a play wave event is automatically created by dragging a wave into the sound (as it sounds like you did), that play wave event defaults to looping if loop points were present, or defaults to one-shot if not. I'm guessing the water had loop points and the other elements didn't, as one would expect. You can change the behavior by clicking on the individual 'play wave' events and setting their Loop flags in the property frame. As a shortcut, if you select the sound (e.g. in the top left frame), it too has a looping property, which maps to all of the play wave events that it contains. (It'll likely default to a grey "partially-selected" state if you've got some tracks looping and others now.) You can make all tracks loop from there.

    Do watch out for what I rambled a bit about in the initial reply -- namely, the play wave events will use the delay and random offset values before firing their waves, but only the first time. From then on, the next wave variation will be chosen immediately, without delay.

    Sorry we missed each other, sounds like you had a good experience at Austin GDC though!

    Cheers,

    Scott

  • 9/19/2007 10:58 AM In reply to

    Re: Need help making a ambient background in XACT

    the problem is that I need the bird wav to float in and out periodically, while the water loops.  The water is looping seemlessly just fine.  All I can get with the bird wav is either one shot......or continuous looping.  Is there any possible way to have a wav play periodically?? say, every 35 seconds? or will the programmers have to do that?

    Thanks!

    Ben

    www.myspace.com/noisebuffet

     

  • 9/28/2007 6:02 PM In reply to

    Re: Need help making a ambient background in XACT

    Yup, that was the limitation I was talking about - the delay is only before the first time the bird would play. So for spurious occasional playback, the programmer will have to fire off a separate cue every time. You can still use the timestamp and offset properties so they only need to fire the cue, wait for it to notify them that it's completed, then fire it again. (This is likely a bit more elegant than the programmer needing to start up their own timer object.)

    -Scott

Page 1 of 1 (7 items) Previous Next