Xbox LIVE Indie Games
Sort Discussions: Previous Discussion Next Discussion
Page 1 of 4 (78 posts) 1 2 3 4 Next >

Raw Sound Buffer Access in XNA 2.0

Last post 10/16/2009 3:09 AM by The ZMan. 77 replies.
  • 8/15/2007 12:10 PM

    Raw Sound Buffer Access in XNA 2.0

    Maybe I have missed something, but from the XNA Gamefest videos I haven't heard one way or the other whether raw sound buffer access will be exposed, like in managed directx. Was there a presentation that addressed this?

  • 8/15/2007 12:23 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I don't recall this being mentioned.

    The only *announced* sound changes were that it will pick up a later version of the XACT engine and editor (I don't know if 100% of new features were announced at gamefest) - see ziggys pictures here http://www.ziggyware.com/GameFest2007/2007-08-13_124806.PNG

     

  • 8/15/2007 12:37 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    ZMan is right, we didn't announce raw sound buffer access.

    That's because it's not going to happen this fall.

    Sorry!

    Just one of the many cool features that didn't quite make the cut when comparing task lists and time estimates with the number of developers and days we had available :-)
  • 8/15/2007 2:31 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Thats OK, lots of cool features are making it into this next release. Thanks for the hard work!
  • 8/28/2007 4:05 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Hey Shawn,

    Thanks to the team for all the hard work put into XNA. I'd just like to echo my own personal desire for this feature. Mainly I'd like to be able to access the sound buffer for the music being played via the dashboard to use interactively for visualization. I can do this on windows using ASIO and some c++, but clearly this approach will fail on XBOX.

    Can't wait for this feature though, so keep us posted if it shows up anywhere on the work queue.

    Adam
  • 10/12/2007 1:22 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I too would really love to see this feature.

    I have it sortof working in my game currently.  I am generating my own wavformdata with 0.25 second length and saving it out as a .wav file.  I then make 4 copies of the file and load all 4 into XACT into seperate wave banks.  This creates 4 .xwb files when you run the game.  At runtime, I am overwriting the raw PCM data in these files in successsion (exactly like a ring buffer).  I then load and play the cues a bit delayed from the audio generation, this gives me dynamic audio playback.

    It would be very nice to not have to jump through these hoops and use a hack to play dynamic audio though :)

  • 10/12/2007 2:04 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Fascinating hack... does it work on the 360 too?
  • 10/12/2007 2:26 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    "Mainly I'd like to be able to access the sound buffer for the music being played via the dashboard to use interactively for visualization."

    If your music isn't dynamic, you should be able to extend the content pipeline to bring a wav file into a good datastructure for use this way.
  • 10/12/2007 7:08 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    acid1789:

    At runtime, I am overwriting the raw PCM data in these files in successsion (exactly like a ring buffer). 



    That's one of the most ridiculously "so evil it wraps around and becomes insanely cool" hacks I've heard about in a long, long time :-)
  • 4/19/2008 10:58 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    That hack sounds awesome, but you can't get truly interactive audio with it because of the 4 audio-fps. I think XNA as a whole (and most of the game industry, tho the trend is changing) is more for graphics. Audio is just kind of "tagged on" with XACT. I know this isn't entirely true, and that I am generalizing. I dont mean to offend, XNA team. But with most of XNA, you get the "Wow this is easy to do" along with the "I can do anything." But with audio, I seem to be missing out on the second half. Sure we can use external libraries and unwrapped directx, but... not on xbox. I understand you guys are adding features, but fleshed out audio would be nicer than some sparkles, I would think. Or at least allow us to get to the flesh (audiobuffer access) so we can flesh it out ourselves. Meh, my $0.02
  • 4/23/2008 5:46 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Louis Ingenthron:
    Or at least allow us to get to the flesh (audiobuffer access) so we can flesh it out ourselves. Meh, my $0.02

    That’s definitely a big feature that is missing in XNA. I need this to be able to generate synthesis sound and music at runtime and having a raw access to audio buffer is the only way to achieve this. The power of modern CPU (and even music generated by the GPU) allow us to imagine new kind of music and dynamic sound experience... Moreover, an api giving access to raw audio is quite easy to develop...
    acid1789:
    I have it sortof working in my game currently.  I am generating my own wavformdata with 0.25 second length and saving it out as a .wav file.  I then make 4 copies of the file and load all 4 into XACT into seperate wave banks.  This creates 4 .xwb files when you run the game.  At runtime, I am overwriting the raw PCM data in these files in successsion (exactly like a ring buffer).  I then load and play the cues a bit delayed from the audio generation, this gives me dynamic audio playback.

    Is this trick suitable to generate a music at runtime ? As i understand, you have to access and modify the files on the disk, but how do you overwrite the raw PCM of this files ? (xwb is a proprietary format) Do you use some kind of data markers in the initial raw PCM to find the range of data to modify in the xwb file ?)

  • 4/23/2008 7:37 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    @lx:

    Is this trick suitable to generate a music at runtime ? As i understand, you have to access and modify the files on the disk, but how do you overwrite the raw PCM of this files ? (xwb is a proprietary format) Do you use some kind of data markers in the initial raw PCM to find the range of data to modify in the xwb file ?)

    That would be good speculation but lets leave this as exercises for the reader.... discussions on reverse engineering MS formats isn't something we want to talk in great detail about here since its EULA breaking territory.

     

  • 4/24/2008 2:09 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I thought XWB files were defined in xwavebank.h, which is freely available in the DirectX SDK isn't it? Or is that just the XDK and I'm getting confused?

  • 4/24/2008 2:14 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Its not in my DirectX SDK so it would seem its XDK only which would match what I was told about it being undocumented (for mere mortals). Of course the wavebank files are probably different on PC ad xbox anyway.
  • 4/25/2008 12:30 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    discussions on reverse engineering MS formats isn't something we want to talk in great detail about here since its EULA breaking territory


    From what I've been told, the European Union explicitly allows reverse engineering for the purposes of interoperability, EULA or no EULA. But, hey, I'm not in Europe, so that probably doesn't affect me :-)

  • 4/25/2008 12:56 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I think you are right... there are various laws that mean you can do this... however MS won't like it if we talk here.. take it over to GameDev.net and let their lwyers worry about it ;-)
  • 4/25/2008 9:21 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    jwatte:
    From what I've been told, the European Union explicitly allows reverse engineering for the purposes of interoperability, EULA or no EULA. But, hey, I'm not in Europe, so that probably doesn't affect me :-)

    So, we are allowed to do this but not to mess around with copy protection stuff (not even in the name of interoperability). That, indeed, does sound like the EU :)

  • 5/1/2008 12:48 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Yeah, sound buffer access would be a very nice (crucial) addition to XNA's (agreed, lacking) audio system.

    That would allow people to code their own audio synthesis system.  I hate XACT, there's no programmatic control, and I hate how volume can be applied only to sound groups.  It's like, I can't lower the volume of each sound without putting it in its own group.  The XACT tool is overly complicated, and all it does is force people to bake sounds at pre-compile time while preventing us from doing things in real-time.

    If binaural synethsis was used, we wouldn't need audio engineers and a separate tool to make up for the asinine multi-speaker setups out there that will never rival 2-channel 3D (binaural) audio.  All we would need is a simple API that lets us place sounds in 3D with velocity, and have full programmatic control over their volume and when they start and stop.
  • 5/1/2008 5:53 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    A lot of people have fallen into the same trap with audio, it's one of those things that people are making more complicated than it should be and end up sacrificing functionality. It's not just XNA/DirectX that has fallen into this trap.

    I am planning to do a remake of a game Mel Croucher, a mate of mine, produced many years ago called Deus Ex Machina.

    It wasn't much of a game, but it had a sound track that was linked into the game very tightly, something no one had done before.

    The sound track featured Donna Bailey, Ian Drury, Frankie Howard, Jon Pertwee, and Mel himself. We still have the original 8 track recordings, yes 8 track was "state of the art" then.

    (Ian Drury played the part of a sperm Big Smile, "Watcha cack I'm a fertilizing agent, my brothers are all wiggly" )

    I have a good version as Mp3, but it is 45 minutes long. Hate to think how big it would be as WAV.

    There are very important parts of the sound track that have to line up exactly with the on screen code.

    So guys, any advise would be very gratefully received.

    How the hell am I going to handle 45 minutes worth of sound in XNA, without gaps, without getting out of sync.

    Ideally I wanted to have the backdrop to all the game sections a visualisation of the music.

    I really want to do this, Donna and Mel are still going, but the rest have sadly turned up their toes and I would like it to be a bit of a tribute to them.

    It's so frustrating, I could do this in minutes with FMOD.

     

     

     

     

     

  • 5/1/2008 10:23 AM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    What an awesome idea... though nobody (including me) really got it back then so even fewer would now

    (for the youngsters out there see http://en.wikipedia.org/wiki/Deus_Ex_Machina_%28video_game%29 and links from there)

    Since the sound track was on cassette all you really need for this game is to match the clocks if you know something happens at 13:02 then make something happen at 13:02. Or if there only so many sync points then break the mp3 at that point and just Q them up in Xact. Have to admit I played th game once I think so I may well be remembering it wrong.

    Would be interesting as an uncompressed WAV - dunno if Xact could take it and the compile step to compress it would be quite long I imagine. Maybe another reason to chunk it.

    Would be a great project to work on - if you are looking for help drop me an email...

  • 5/1/2008 12:51 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I think there's actually a pretty easy solution for this:
    • Wait for the 3.0 framework
    • Use our new MediaPlayer API to play your compressed audio
    • Use MediaPlayer.PlayPosition to sync your game with the music
    • Use MediaPlayer.GetVisualizationData for your background
  • 5/1/2008 12:55 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Do all of these APIs work on windows and 360 too - previous mentions of MediaPlayer have been limited to talking about Zune.
  • 5/1/2008 1:21 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    So... this is the first I've heard of this API for Windows and 360. From the brief description, it sounds good for the sync-music requirement.
    Will there be a way to add MP3 files or WMA files to the media library when installing the game, while still keeping them separate from the user's library? Will they get un-installed if the game is un-installed?

    Will it also allow playing generated music/sound?
  • 5/1/2008 1:33 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    The ZMan [MVP/Moderator]:
    Do all of these APIs work on windows and 360 too - previous mentions of MediaPlayer have been limited to talking about Zune.


    This is on all platforms.
  • 5/1/2008 1:35 PM In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    jwatte:

    Will there be a way to add MP3 files or WMA files to the media library when installing the game, while still keeping them separate from the user's library? Will they get un-installed if the game is un-installed?


    Yes. You add .wav, .wma, or .mp3, files to your content project, and they're deployed long with your game. At runtime you can either play these songs that you deployed, or other ones from the users music library.

    jwatte:
    Will it also allow playing generated music/sound?


    No.
Page 1 of 4 (78 posts) 1 2 3 4 Next > Previous Discussion Next Discussion