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

To XACT or not?

Last post 18/09/2009 17:50 by Allan Chaney. 22 replies.
  • 02/07/2009 14:11

    To XACT or not?

    Hi,

    I've tried to figure out what the most common approach is, but unfortunately haven't yet fully succeeded.

    Is it a good way for example to use XACT for sound effects, and use the normal content pipeline for things like background music (mainly because of file size issues, as one can then use MP3s)?
    What's the major drawback of not using XACT? Is it the absence of the DSP(this is a guess now)?


    Thanks!
    Christian
  • 02/07/2009 14:38 In reply to

    Re: To XACT or not?

    I used XACT at first, but I find it much eaiser and cleaner to not use it.  I use a static audio class and wav files.  MP3s can be a little slow.  I hope this helps.



    Games: ZenHak

    Other: Plasma Break In, Mayan Countdown

    Zenfar ZenHak, Plasma TV Break In, and WiiPunch...
  • 02/07/2009 14:55 In reply to

    Re: To XACT or not?

    I started out using XACT then when XNA 3.0 came out I switched over to soundeffects.  The only sounds I kept in Xact were those I wanted to have a 360 surround effect applied to since that's a simple check box feature in XACT but is unavailable in soundeffect.

    Now with XACT 3.0 the game has changed again.  You get better compression with xWMA in XACT than you do using soundeffect and the the Best, Better, Low compressions setting.  If I've read things correctly, xWMA is a better form of compression that results in smaller file size but better audio quality.  So now I use  XACT for my music and sound effects with 360 surround activated.  I use soundeffect instances for everything else.

    I spent days with XACT trying to get a variable tied to an RPC Preset tied to a sound in order to simply change the volume of a sound in game.  I could not get it to work.  I wanted to apply the Fadin, FadeOut check box options in XACT to my music.  Seemed simple enough but I couldn't get it to work.  I used the .Stop(AudioOptions.AsAuthored) method but it did not apply the fadeOut effect though I had applied that in XACT.  The only volume adjustment I was able to get working in XACT was by using a category, then I change the category volume in code in order to fadein and fadeout my music.

    I really wish there were better documentation/tutorials for XACT....specifically for variables, RPC presets, instance limiting, FadeIn, FadeOut.
  • 03/07/2009 9:03 In reply to

    Re: To XACT or not?

    So far I am quite pleased with what XACT 3.0 lets you accomplish, but you need to be prepared for lots and lots of stress. It's not terribly well documented, it has some crazy bugs, and you're going to have to put some real effort into getting good results out of it. However, I do have to say that most of the big factors - how well does it run, how well does it compress, how is the audio quality - it does quite well on. And the XACT editing/auditioning tool is pretty good, despite having a very clunky user interface.

    Overall, there are definitely far worse tools than XACT out there, and it's probably faster to use XACT than rig up your own advanced sound system if you're building a sufficiently complicated game - especially since there are things you can do with XACT that you can't do with just SoundEffect/Song on the 360. (On PC, you can use libraries like FMod, but that's an extra dependency and costs money, so sticking with XACT is still a pretty good idea.)
    Kevin Gadd, Squared Interactive
    Development Blog | Twitter
    Help playtest my game, Inferus!
  • 03/07/2009 10:49 In reply to

    Re: To XACT or not?

    Allan Chaney:
    I wanted to apply the Fadin, FadeOut check box options in XACT to my music.  Seemed simple enough but I couldn't get it to work.


    It's not just you. I've spent a good few hours trying different things trying to get fade-in/out working and no luck... I've tried one cue with multiple wavs, 1 sound effect with multiple tracks and multiple cues all with the instance limit set to 1 and fadein/out set to 3 secs each. Is there a way to diagnose what XACT is doing under the hood? It'd be much easier to track down what's going missing if I could see at which point(s) I've not done.

    Oh yeah and if anyone has managed to get fade in/out to work in XACT and can post a start-to-finish tutorial I'd be really really grateful!
    PebbleDash - Released
    Abstacked - Released
  • 03/07/2009 11:06 In reply to

    Re: To XACT or not?

    It's probably a question of taste which way to go. The decision is only made for you if you want to use a feature that only XACT has to offer. But if you only need basic features, so that both solutions would be possible, you have to find out for yourself which one you prefer. There's no simple recommendation of which one is "best".
     
    For example, while Alan described how he switched over from XACT to SoundEffect with XNA 3.0, for me it wasn't so: I started with XACT in XNA 2.0, when you had to use it, and when XNA 3.0 came out I was already so used to using XACT, I never bothered switching to SoundEffect/Song. I'm perfectly happy with using XACT. For the basic stuff, I don't find it very hard to use at all (in fact I always wonder how people complain about it, when I think it's quite straight forward and easy to use, for the standard stuff). And even with the basic stuff, there's already more flexibility in it. For example, I often grab a sound effect off soundsnap.com that is only almost right. So I end up varying the pitch a bit, or (quite often) the volume etc. I just find it much easier to do this in XACT, where I can just start playing the sound effect (in a loop) and then fiddle with the sliders until I like the sound. That's especially useful for setting the volume of a sound so that it matches the other sounds in the game: First I start one of the other sounds in a loop as a reference, then I also loop-play the new sound and fiddle with it until its volume matches the other sound.
    Or for example I "composed" an explosion sound because I couldn't find one that sounded like what I wanted: So I took three or four different original sounds from soundsnap (of fireworks, a screeching rocket, etc.) and combined them in XACT to a single sound effect, where I set the volume, pitch and delay on each "sub-sound" so that in total they gave me the rocket-screeching-ending-in-explosion sound that I wanted. And in my code I can still reference and play this "composition" as a single cue.
    And all this without doing XACT tutorials or similar, but simply by exploring what the XACT GUI offers (so that's actually only scratching at the surface of what XACT has to offer, but is already very useful).

    Doc
    Please consider playtesting my game: Your Doodles Are Bugged!

    Twitter - My Game Trailers - www.spyn-doctor.de - Games: Kuchibi, Golden Tangram

    Useful for peer reviews and testing your own game: My little "evil" checklist for peer review stress testing
  • 03/07/2009 11:09 In reply to

    Re: To XACT or not?

    lutas:
    Oh yeah and if anyone has managed to get fade in/out to work in XACT and can post a start-to-finish tutorial I'd be really really grateful!


    Do you mean a fade-out that happens if you do "StopAsAuthored()"? I got this working with a few clicks in XACT after finding a description on the web somewhere on how to do this. If that's what you are looking for, I can check what I did and post it here...

    Doc
    Please consider playtesting my game: Your Doodles Are Bugged!

    Twitter - My Game Trailers - www.spyn-doctor.de - Games: Kuchibi, Golden Tangram

    Useful for peer reviews and testing your own game: My little "evil" checklist for peer review stress testing
  • 03/07/2009 11:21 In reply to

    Re: To XACT or not?

    Yeah I'm using stop as authored and then I call play on the same cue again (with multiple wavs belonging to the same cue)
    PebbleDash - Released
    Abstacked - Released
  • 03/07/2009 18:11 In reply to

    Re: To XACT or not?

    I spent days with XACT trying to get a variable tied to an RPC Preset tied to a sound in order to simply change the volume of a sound in game.  I could not get it to work.

    The "problems" with XACT are all with the UI of the tool. Some things, like the attack and release volume waves, are not very intuitive, but when you know how to use them, they are a snap. Similarly, the RPC-to-volume mapping is very easy to use, once you've done it once. I think what you need is to read through the documentation on MSDN, and one or two good tutorials on the web, and then you'll have a different view of XACT. It's a really nice and capable tool, and a great way of authoring sounds that are more complex than your typical menu "button beep."

    For example, if you want to create a flexible crash effect that starts with an initial contact sound, followed by a resonant thump, followed by some secondary debris/scatter sounds, then you can sample three variations of each of those, and set up a playlist for a cue in XACT that gives you 27 different crash effects! If you add random variation of pitch for each of the sounds as well (just up/down 1 semitone is plenty), you get a sound effect that will never sound the same twice. Try doing that with SoundEffect, I dare you! :-)

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 03/07/2009 21:01 In reply to

    Re: To XACT or not?

    jwatte,

    Thanks for your reply on this subject.

    If anyone could provide some links to website tutorials or even the MSDN documentation that describes the use of variables, RPC presets, fadein, fadeout it would be greatly appreciated.  I've read everything I can find on MSDN and I haven't found anything that addresses the fadein, fadeout and limiting instances or the setup of a variable and RPC preset with code to show how to use it.  I've found very basic examples on MSDN on variables and RPC but it's only "Here is what this option does.".......  Not Here is how you setup a variable, RPC Preset and the code you need to use it.  I have some books that do a good job of demonstrating combo sounds in XACT like you describe.  But it's funny, out of the 7 XNA books I have, not one attempts to address using a variable or RPC preset for anything.  The only example I can find on MSDN that controls volume, uses a category to change music volume. 

    I specifically checked the Limit Instances check box on my music Cue Name and even on the Music Category that I have assigned to my game music.  I chose Replace, Lowest Priority, Linear for the buttons.  I set Fadein and out to 3.0 (secs).

    I play the cue sound...no fadein.

    I stop the cue music with .Stop(AudioStopOptions.asauthored); ......no fadeout and the music keeps playing.  i have to use Immediate to get it to stop.

     TitleTheme.Stop(AudioStopOptions.AsAuthored); 

    Allan
  • 03/07/2009 21:02 In reply to

    Re: To XACT or not?

    I sshould probably add that I've done a bunch of web searching and can't seem to find any tutorials on XACT that demonstrate the use of variables and RPC presets.

    Again...any links at all would be appreciated.

    Allan
  • 03/07/2009 22:37 In reply to

    Re: To XACT or not?

    You need to set the fade-in and fade-out curves in the curve editor, and assign them to your sound.

    I create an "RPC Preset" called "Music Attack Releaese."
    Then I edit this preset, and for Variable, I choose "Attack Time," I have it affect Track 1 and Volume.
    I add another Variable to the preset, I choose "Release Time," and I have it affect Track 1 and Volume.
    Now, I can attach this pre-set to a music sound, and it will fade in/out as appropriate.

    Btw: make sure that you call AudioEngine.Update() each time through your Game.Update(), if you don't already.
    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 04/07/2009 0:29 In reply to

    Re: To XACT or not?

    Jwatte,

    Thanks...I'll take a look at that.  I thought the fadein, fadeout were some kind of presets.  I didn't realize I needed curves in the curve editor in order to define them.  I just assumed when you chose Linear vs. Logarithmic, Equal Power, as a crossfade Type in the Instance Limiting Window, you were defining a straight curve for the fade.  Man that's confusing that you also have to define a curve manually.

    Also I like using a game component for my AudioManager.cs.  That way I can put the AudioEngine.Update() in that components update loop and I'm gauranteed that it gets hit every game update cycle.

    Allan
  • 07/07/2009 5:58 In reply to

    Re: To XACT or not?

    Hey Guys,

    Did some experimenting with XACT.  

    Allan, I figured out why the built-in crossfading wasn't working for you... 

    ---------------------
    WAYS TO CROSSFADE
    ---------------------
    1)  As Jwatte suggested above, use an RPC Preset, and attach any sounds you want to crossfade in your game to it.  Then, whenever you play the cue, it will fade in.  Right before you play the next cue (or same cue), issue a StopAsAuthored, so that it fades out at that moment.  With this method, you will always hear the fade in, even when started from stop (silence).  The RPC preset method gives you a good global fade in/out solution.

    2) Built in cross-fading with cue instance limiting

    Use this if you just need to cross-fade between sounds in a specific cue.  Cues hold a list of sounds.  When you play a cue, it will play one of the sounds.  Which sound it plays depends on the "cue variation playlist" (random, ordered, interactive variable, etc)  Each sound can be composed of multiple waves, put together in seperate tracks, so that when you play the sound, they tracks all play at the same time, and you hear the resulting product. 

    Lets say I have a Cow cue with three sounds:  CowMooing, CowChewing, CowFarting.  Each time I play the cue, say when the user presses 'A', a new instance of the sound starts playing.  I setup the cue variation playlist to be random, so I might get moo, chew, chew, moo, fart, etc...  Normally these sounds would overlap if the user kept pressing 'A' super fast.  But since I set cue instance limiting max 1 and behavior at max to replace, I don't get a bunch of instances all playing at the same time.  Instead,  this instance limiting causes the previous sound to stop and new sound to start abuptly.  Next, selecting cross-fading will allow the transition to not be so abrupt.  And finally, if you needed to wait to the end of the cows 5 minute moo, before heading into the next sound, this is where Transitions with the option 'END OF SOUND' or 'END OF LOOP' would come into play, solution number 4.

    3) Built in cross-fading with category instance limiting 

    If you have a bunch of cues and you need to cross-fade not only between sounds in a specific cue, as in the above solution,
    but also BETWEEN sounds in seperate cues, use the limiting in category instead.

    Allan, I noticed the reason the fade-in isn't heard right away in 2) and 3) above, is because:  the crossfade behavior only kicks in when a replace occurs.  That is, when the max instances is attempted to be exceeded.  So the first time you play the cue, you won't hear any fade-in, as there is only 1 instance.  If I let the sound complete (it stops and the instance dies), and start it from this silence, I still don't hear any fade-in, because again, it's only 1 playing instance.  For "fade in, that includes starts/silence" behavior, solutions 1) or 4) seem the way to go.  You could, of course, still use instance limiting and just edit any intro waves to include the fade in.

    4) Interactive Variables and Transitions

    Transitions allow you to have more persise control over how you go from one specific sound to another specific sound.  For crossfading, this is probably an overcomplicated solution.  I think solutions 1) or 3) are easist and best. 

    Here's my example transition, going back to the cow object again :)  Say we wanted to make it so when a cow moo is heard, followed by a cow fart, an intermediate 'stomach moan' transition sound was heard.  Transitions let you do that.  Or on two successive cow moos, 'loud applause' transition is played on-top.  Transitions would let you do this too.  A cross-fade would be another type of transition.

    This is done by specifying each of the 9 combinations in the transitions pop-up. 
    Example: From:  stop (silence) to
                            moo,
                            chew,
                            fart
                 From moo to
                           chew
                           moo
                 From chew to
                          moo
                         fart
                 From fart to
                         chew
                         moo 

    Transitions require interactive variables.  When the user hit 'A' and played the cue, the sound selected to play was random.  It could have been ordered, where it is played in list order.  There's also interactive.  With interactive, a variable is used to determin which sound is played.  Moo sound range might be set from 1-40, chew from 41-90, and fart from 91-100.  Like RPC, variables are used to control things.  But instead of controlling parameters, the interactive variable you create and select in your cue controlls:  which sounds get played.  The sound that gets played is whatever one has a range that contains the variables current value.  This value is sent to XACT by:
    ----- Cue Instance Variables -----
    Cue cow = sounds.GetCue("cow");
    cow.SetVariable("CowState", 1);
    ----- Global Variables -----
    audio.SetGlobalVariable("GlobalVariable", 1);

    If your variable changes in code, if it makes a new sound range, the new sound for that range will be played immediately and old sound end.  
    If you setup the ranges so that they all overlap, say all 1-100, the sound selected seems random.  The sound is played immediately.  You don't even need to re-issue a play cue.  If you don't want that abuptness, then in Transitions, select END of SOUND or END of LOOP for source in all the items.  In transitions, select (Crossfade without Transition) for the items you want.  This will mean when your variable switches from sound A to sound B, there won't be an intermediate transition sound throw in, like the 'stomach moan' (Sequential Transition), nor an overlapping sound like the 'loud applause' (Concurrent Transition) Instead, in this scenario, when the variable switches from sound A range, to sound B range, we simply crossfade.

    5) Controlling the volume of individual tracks or sound using SoundEffect API, based on variables changing with time (stopwatch class)

    Anyways, these were my crossfade findings!  I'd imagine 1) RPC Presets 3) Category instance limiting and 5) Volume control are the most common methods used in XNA games.  If you've got any methods that work for you, feel free to add!

    Cheers,
    TOPSP1N (Chad)
  • 08/07/2009 9:12 In reply to

    Re: To XACT or not?

    Thanks for your opinions guys!
    I guess since we got things running with XACT, we'll stick to it and try using the compress-settings.
  • 21/07/2009 15:05 In reply to

    Re: To XACT or not?

    I finally managed to get the standard fade in/out with a single instance stuff working in XACT.

    In case anyone is struggling with it not working at all as I did, I noticed that removing my cue.Stop(AsAuthored) call solved the problem.

    Kind of a "well, duh!" moment but if you have "single instancing, set to queue" and call play on the cue again in code, the framework will automatically stop your current track and fade out/in automagically.
    PebbleDash - Released
    Abstacked - Released
  • 19/08/2009 22:35 In reply to

    Re: To XACT or not?

    So how do you get XACT to work? When I tried it a black console window popped up and said "Waiting for authoring tool or authentication" and then just sat there. I had to hit "Q" to quit. When I tried to follow example in Beginning XNA3.0 Game programming book pp. 32-37 my project does not build. It complains that file not found in the folder but I checked and it is there so just in case I copied to the Content folder and checked the binary is in bin folder. so what is going on?
    Thomas W. Rodke
  • 19/08/2009 23:37 In reply to

    Re: To XACT or not?

    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
  • 20/08/2009 12:22 In reply to

    Re: To XACT or not?

    thanks, but specifically on my PC I get the following error message when I try to build the sample XACT "kaboom" sound demo project: C:\Documents and Settings\R\My Documents\Visual Studio 2008\PlaySound_Sample[1]\PlaySound\PlaySound\Content\Content.contentproj(52,11): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\XNA Game Studio\v2.0\Microsoft.Xna.GameStudio.ContentPipeline.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. I don't understand why it is not finding the file?
    Thomas W. Rodke
  • 20/08/2009 13:04 In reply to

    Re: To XACT or not?

    If you're talking about this project, it works fine on my machine just by pulling it out of the zip file, doing a Rebuild and running in debug. If that's not the one you're running what are you running?
    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
  • 22/08/2009 2:25 In reply to

    Re: To XACT or not?

    Yeah, it works. I was running 3.0 still so I upgraded to 3.1 and it works now. I guess I was hesitant to upgrade to 3.1 before, because I still hadn't finished going through the book "Beginning XNA 3.0 Game Programming - From Novice to Professional" by Lobao, Evangelista, Farias and Grootjans; and I didn't know the extent of the changes between revisions. But now that I have upgraded I will just handle any incompatabilities as they happen. Thanks, Tom
    Thomas W. Rodke
  • 18/09/2009 10:44 In reply to

    Re: To XACT or not?

    Hi,

    some time ago I too wanted to make dynamic music and modify it at runtime. I found some cool tutorials and wrote an article about it at our blog: http://blog.brightside-games.com/?p=109
     
    cheers Volker
  • 18/09/2009 17:50 In reply to

    Re: To XACT or not?

    Volka,

    Nice post!  This will come in real handy when I get back to sound production.

    also thanks for the link to the other XACT tutorial in your blog post.

    Great stuff!

    Allan
Page 1 of 1 (23 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG