XNA Creators Club Online
Page 3 of 4 (78 items) < Previous 1 2 3 4 Next >
Sort Posts: Previous Next

Raw Sound Buffer Access in XNA 2.0

Last post 16/10/2009 3:09 by The ZMan. 77 replies.
  • 22/05/2008 18:35 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    You show me proof and I'll believe it. It has always been the case that publishers do not just give up rights to their games to run on emulators. If you can provide a source that shows all of the publishers and their actual press releases or web sites where this is stated, then I'll concede that you are correct. Until then I'm fairly confident that that isn't true at all.
  • 22/05/2008 18:36 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Prove it.... becuase thats what you will have to do when the lawyers come calling...

    I'm not saying there are no games with licensed allowed in this way. However its certainly NOT the majority.

    For arcade games for example http://en.wikipedia.org/wiki/MAME#Legal_status_of_MAME - almost none... at least not any good ones ;-)

    I know Amstrad allowd the Speccy roms to be released http://www.worldofspectrum.org/WoSFAQ.html#2M and due to some very dillgent work that site has contacted many game publishers to specifically get permission but ONLY FOR THAT SITE http://www.worldofspectrum.org/permits/publishers.html. Note that this doesn't give anyone else the right to distribute.

    Other computers... well in general you can't find that level of information and you can't assume jsut becuase its on a web site that they have permission.

     

    Play Kissy Poo - a game for 4 year olds on Xbox and windows
    The ZBuffer
    News and information for XNA
      Follow The Zman on twitter, Email me
        Please read the forum FAQs - Bug/Feature reporting
          Don't forget to mark good answers and good playtest feedback when you see it!!!
  • 22/05/2008 18:45 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I won't make such a list available (it is mine know-how, you can believe me or not).
    Let us come back to the topic i.e. the access to sound buffers, it is more important
  • 22/05/2008 18:55 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    xaudio2:
    Let us come back to the topic i.e. the access to sound buffers, it is more important

    Again, prove it!

    Write a game that does something awesome and original using dynamically generated audio.

    Right now you can't do that on Xbox, but you can do it on Windows. Actions speak louder than words. The best way to persuade us that this functionality is important on Xbox is to demonstrate what you can do with it on Windows.

    XNA Framework Developer - blog - homepage
  • 22/05/2008 19:11 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    To come to xaudio2's defense: It's already proven. There are multiple of console emulators out there, that run ROMs of various degree of legality (and, yes, I know that there are legal ROMs from some vendors, as well as community games). You can't run an emulator without procedural audio.

    That being said, there are other games that exist today, that are more or less awesome, that can't be done with the current sound APIs. Some that come to mind include Guitar Hero, Dance Dance Revolution, Taiko Drummer, and the various pitch-scoring Karaoke games. I could totally see some artist releasing an album as a compressed "game" with some interactivity, fitting just barely into the 150 MB limit. However, interactive music is not currently possible because you don't get sample sync out of XACT, so you have to do it yourself.

    Finally, I believe you already know of the various demos using procedural sound to fit into 4k, 32k or 128k limits. That's more "art" than "games," though. Whether xaudio2 himself could create those, I don't know, but it's clear that "the community" as a whole, can. Well, except not on the Xbox.

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 22/05/2008 20:37 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    jwatte:
    That being said, there are other games that exist today, that are more or less awesome, that can't be done with the current sound APIs. Some that come to mind include Guitar Hero, Dance Dance Revolution, Taiko Drummer, and the various pitch-scoring Karaoke games. I could totally see some artist releasing an album as a compressed "game" with some interactivity, fitting just barely into the 150 MB limit. However, interactive music is not currently possible because you don't get sample sync out of XACT, so you have to do it yourself.
    Finally, I believe you already know of the various demos using procedural sound to fit into 4k, 32k or 128k limits. That's more "art" than "games," though. Whether xaudio2 himself could create those, I don't know, but it's clear that "the community" as a whole, can. Well, except not on the Xbox.

    Thanks for pointing out some games that use the audio not as a simple jukebox, i completely agree with you.

    One thing that is quite amazing with .NET is that, even on windows, we don’t have currently an official managed audio api that enable us to implement dynamic audio streaming.  Directsound is abandoned, XAudio2 is not available in .NET and is in a limited version in XNA…

    Take a look at this small article from Mark Heath about “Who Cares About Audio?” and you will understand that audio in .NET – and in XNA - is truly the fifth wheel of the coach.

    @lx - Code4k
  • 22/05/2008 21:52 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0


    jwatte:
    Oh, there are lots of toys that it is neat to program for. Every hacked your TiVo, for example?
    Seriously, though, do you believe you will sell any games for the Zune? I mean, in quantities larger than single digits?
    Or, if you gave the game away for free, do you think you'd get more adopters than that (who do more than just try it out)?

    This has interested me to buy a Zune sometime down the line, and I don't plan to make money off it. I've thought of lots of little things I could create for it, for my own amusement.
  • 22/05/2008 21:57 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    In addition to the pleasure of working with the Zune, I also wouldn't be so sure you can't make money off of Zune games. In two weeks I've had about 9,300 downloads of Alien Aggressors for the Zune. I've also got an additional 1100 or so from Scrambled Albums. That's a lot of downloads for a CTP that isn't even geared towards end-users. Imagine what will happen when the barrier for deploying these games is lowered. It's crazy to think about. Might not be enough to run a whole company, but you could probably still make some money in that area. Technically I've made around $115 from people donating to my site since the Zune launch. I'm not sure if that's from the tutorials I have or the Zune games, so it's not clear what exactly about my site they are supporting.
  • 22/05/2008 22:07 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0


    Nick Gravelyn:
    In addition to the pleasure of working with the Zune, I also wouldn't be so sure you can't make money off of Zune games. In two weeks I've had about 9,300 downloads of Alien Aggressors for the Zune. I've also got an additional 1100 or so from Scrambled Albums. That's a lot of downloads for a CTP that isn't even geared towards end-users. Imagine what will happen when the barrier for deploying these games is lowered. It's crazy to think about. Might not be enough to run a whole company, but you could probably still make some money in that area. Technically I've made around $115 from people donating to my site since the Zune launch. I'm not sure if that's from the tutorials I have or the Zune games, so it's not clear what exactly about my site they are supporting.
    That's good news Nick.

    I have doubts about the Zune though. People on these forums are talking about day long down times on their machines. I use my current player constantly, I couldn't stand having my machine go down for a day at a time. Is it reliable? Is the battery user replaceable? I'm also very wary of MS hardware since being the unfortunate owner of an original XBox, and the stories of the 360. Also, is Zune deployment a creator's club thing?

  • 22/05/2008 22:18 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    No you dont need CC but you do need to upload everything from source code form Visual Studio so there is a fairly high barrier to entry right now. We are hoping this won't be the case for final release but nothing is confirmed.

    As for the 'down time' there are always a certain percentage of bad hardware - you can rarely rely on internet forums to determine the percentage. I dont see any way to change the battery... better to ask on zune.net forums though I suspect.

    Play Kissy Poo - a game for 4 year olds on Xbox and windows
    The ZBuffer
    News and information for XNA
      Follow The Zman on twitter, Email me
        Please read the forum FAQs - Bug/Feature reporting
          Don't forget to mark good answers and good playtest feedback when you see it!!!
  • 22/05/2008 22:19 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    I've not once had my Zune crash for any extended period of time. And no, you don't need a CC to deploy to Zune. Anyone can do it. Granted right now you have to give away the source to your game, then they have to install VC# 2008 and XNA GS 3.0 CTP, but apparently that hasn't stopped all the people out there downloading games now. Plus it's cool that a lot of the people downloading the Zune games are starting to look at C# so they can play around with editing the games. Sure a lot of them will just give up after they get their 100 lives or whatever, but I'm sure that this will attract at least a handful of dedicated people to C# and XNA.
  • 23/05/2008 18:42 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    the stories of the 360.

     

    Yes, the 360 appears to have a poor reliability record. One would hope that the newer versions (Arcade, etc) have re-designed the weakest points. My personal box has had two failures, each of which took two weeks of downtime to have repaired. Meanwhile, my competing next-gen console (which incidentally is a great Blu-Ray player) has never needed service. That's just a sample of one, though.

    To Microsoft's defense, they did the right thing with the RROD warranty extension. As a company they really do seem committed to the long-term success of the Xbox, and investing in the service to make it the most seamless experience on the market. It really is a lot better than the competition in that regard.

     


    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 04/06/2008 10:34 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0


    Shawn Hargreaves:
    I think there's actually a pretty easy solution for this:
    • Wait for the 3.0 framework

    Will it be possible to mix XNA GS 2.0 with the XNA GS 3.0 sound libraries?

    I don't want to port my game to XNA GS 3.0 only to get this better sound handling.

     

    Daniel

  • 04/06/2008 11:22 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Mixing and matching the assemblies is not something that has been supported in the past... plus the content importers may not appear in VS05..

    However its VERY likley that your 2.0 game will run under 3.0 with either no changes or very few given the direction they took with 1.0 -> 2.0 conversions so I wouldn't worry about it.

    Play Kissy Poo - a game for 4 year olds on Xbox and windows
    The ZBuffer
    News and information for XNA
      Follow The Zman on twitter, Email me
        Please read the forum FAQs - Bug/Feature reporting
          Don't forget to mark good answers and good playtest feedback when you see it!!!
  • 04/06/2008 13:47 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    A little comeback on this subject, just to give you a link about an interesting news in Adobe Flash Player 10 : Dynamic Sound Generation. Take a look at this simple sample code :

      var sound:Sound = new Sound();  
      function sineWavGenerator(event:SamplesCallbackEvent):void {  
        for ( var c:int=0; c<1024; c++ ) {  
          var sample:Number = Math.sin(  
                   (Number(c+event.position)/Math.PI/2))*0.25;  
          sound.samplesCallbackData.writeFloat(sample);  
          sound.samplesCallbackData.writeFloat(sample);  
        }  
      }  
      sound.addEventListener("samplesCallback",sineWavGenerator);  
      sound.play();  

    It generates a simple sinus sound, pretty easy no? With a simple callback API (and in a nice way with the event’s paradigm), it’s possible to generate dynamic sound. This API doesn’t look like an “ugly raw buffer API” and can be definitely be considered as a good candidate for a “High Level .NET Managed Code Sound API” and this is the kind of Sound API that .NET (and XNA) should have in order to provide a full sound experience for games.

    Or perhaps, will it be proposed by the Silverlight team if Silverlight want to compete with the Flash product?
    @lx - Code4k
  • 04/06/2008 17:20 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    That code still generates a sound buffer, but does it using a less efficient "write()" paradigm. MDX used to have the GraphicsStream class that let you "write" to graphics buffers, but that turned out to be just a bad idea. It's better to use an array of type as a buffer. I don't think that the specific API by which the buffer is generated matters much, as long as it's reasonably efficient (and I don't think that JavaScript code you're showing actually is that, because of the buffer call overhead for each sample).

    It seems, to me, as if audio is a third class citizen in the XNA framework. The graphics management is fairly bug free, at least as long as you stay on the beaten path. You can create procedural graphics, and drive the device in most ways that you wish to. Audio, however, is plagued with crashes, inconsistent implementation and a very minimal API. Why is that? Audio is at least as important as graphics for a good gaming experience. Imagine turning off the sound and trying to play any game -- it would suck! Audio needs the same love as graphics, and it's a shame that it doesn't get it.

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 04/06/2008 19:57 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    jwatte:
    It's better to use an array of type as a buffer. I don't think that the specific API by which the buffer is generated matters much, as long as it's reasonably efficient (and I don't think that JavaScript code you're showing actually is that, because of the buffer call overhead for each sample). [...] Audio is at least as important as graphics for a good gaming experience.

    I completely agree with you and i was not pointing out that we should have the same exact API, or that hiding the sound buffer through write methods is the best solution. I was more focusing on the amount of code needed to enable dynamic sound generation (in the previous example, we could also discuss that even the write methods would be inlined by the .NET JIT… .etc.).

    So this is more related to this point : a “High Level Managed Sound API” and it is related to what Shawn Hargreaves said in an earlier post here :

    Shawn Hargreaves:
    One of the differences between managed and native API design is that native APIs often just expose low level functionality, so people can then build something useful on top of it. That approach makes lots of things possible, but also everything tends to be pretty hard. Managed code uses a different design philosophy. The goal is not so much to provide low level building blocks, but to build things that directly solve actual problems for our users.

    I agree with this and i’m just pointing out with this example that it’s possible to have an API that meets this kind of requirement. We don’t need an access to a Directsound SecondaryBuffer’s like, because this kind of low APIs always tends to produce the same kind of ugly code in order to do simple dynamic sound generation. For example, take a look at the class DirectSoundOut from the NAudio Codeplex Project. This is exactly what should be hided (all the plumbing to do “audio double buffering” and feed the buffer with a callback) and this code is certainly behind the Sound Class from the previous Javascript sample. For dynamic sound generation in .NET, we don’t need more than this kind of API (and so, it’s obvious that behind this, the code is extremely simple).

    @lx - Code4k
  • 04/06/2008 22:25 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0


    I was more focusing on the amount of code needed to enable dynamic sound generation


    I see.

    I think the XAudio2 API for pushing buffers is just fine, and very simple to use. However, the code to set up a mixing/rendering/effect send path could probably be simplified. (That's an understatement :-)

    For XNA, I'd be happy to get something like the below code.

    Note that I've purposefully cut this to the absolute bone. No panning, no effects, no pitch bend, no notification, no callbacks -- just the absolute minimum you need to push data into a sound out stream. If you want to stream, you push samples in, and when FramesLeft falls below some threshold, you push more samples.

    (Note: in audio, 1 frame == N samples for a N-channel sound)


    interface IStreamOut : IDisposable { 
      void PushData(float[ framesAsInterleavedSamples); 
      void SetOutputVolume(float volume); 
      bool IsPaused { setget; } 
      int FramesLeft { get; } 
     
    IStreamOut MediaPlayer.NewStreamOut(int numChannels, float frameRate); 
     
    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 04/06/2008 22:31 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Vote for this feature if you want it to happen!
    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 21/03/2009 19:44 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Alexandre Mutel:
    A little comeback on this subject, just to give you a link about an interesting news in Adobe Flash Player 10 : Dynamic Sound Generation. Take a look at this simple sample code :
    Or perhaps, will it be proposed by the Silverlight team if Silverlight want to compete with the Flash product?

    Just to let you know that the SilverLight team finally bring RAW audio pipeline to the new SL3. This is a great news, as it is the first time that a .NET product bring this functionnality!

    Although, the current implementation has a high latency, but it's already great to have access to an audio stream. Realtime and interactive visual and sound experience is near to be a reality!

    I hope that XNA Team will be more inclined to bring this feature to this fantastic framework! ;)

    @lx - Code4k
  • 23/06/2009 22:38 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Speaking of...
    I just posted a question about this exact thing.
    http://forums.xna.com/forums/t/33631.aspx
    I have an idea for the sound please check it out and let me know what you think.
    Also if you have any idea's for the sound let me know.  Thanks.
  • 08/09/2009 7:20 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    last night i created a synthesis engine for xna/xact that really works. Its no good for your emulators and such - but for dynamic music its perfect. Ill be creating a proof of concept that ill share the source over the next few days but heres the jist of what i did:

    load ur favourite audio software (jeskola buzz/fruityloops/cubase etc)
    load your fave synth
    mute everything but osc 1
    record a few seconds of synth being played at C-3
    mute everything but osc 2
    record a few seconds of synth being played at C-3
    mute everything but osc 3
    record a few seconds of synth being played at C-3
    load recording 1 in a sample editor
    zoom in to the middle and trim to one repitition of the waveform and save
    load recording 2 in a sample editor
    zoom in to the middle and trim to one repitition of the waveform and save
    load recording 3 in a sample editor
    zoom in to the middle and trim to one repitition of the waveform and save
    load the three samples into XACT
    set them to infinitely loop and add control for things like filter cutoff, volume etc

    you can now play them (all three together) in XNA - the will sound like a basic version of your fave synth - manual code an LFO for the cutoff, and program your own ADSR - and boom, proper synthesis.


  • 16/09/2009 11:44 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Good lord, that sounds like a hassle.

    All I want to do is generate my own PCM sound data. I can generate graphics, so why the hell can't I generate sound?

    I just made up another hacky way to do it:

    Make a sound effect that's just a high-quality sine wave. When you want to play a block of PCM data, do a fast Fourier transform on it to separate it into frequencies. Then, play a bunch of sine waves at different frequencies, phases, and volumes, according to the results of the Fourier transform. The sounds will mix together and hopefully reconstruct your PCM sound. Congratulations.

    Whatta load of rubbish.
  • 16/09/2009 17:52 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    The GPU can make a mean FFT processor, btw :-)

    Unfortunately, you won't get the sync you need to play back the FFT; at a minimum, you will get phasing artifacts, plus clicks at the block boundaries. And with a large enough FFT window to reduce those artifacts (say, 8192 frames per window), the latency is going to be bad (in that case, about 200 milliseconds, plus mix/playout delay).

    Really, we just need them to give us that StreamOut interface I suggested above. I bet someone could implement that over a lunch break(!) if they just wanted to.

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 18/09/2009 2:37 In reply to

    Re: Raw Sound Buffer Access in XNA 2.0

    Have you ever tried using ILDASM (from the Windows SDK) on the Microsoft.Xna.Framework dll file? Looks like the SoundEffect class actually has a constructor that lets you specify the sound format and data, but it's private. We can't use it.

    It's like Microsoft doesn't want to make the XNA Framework TOO powerful. There have to be some arbitrary limitations or else we might like it too much.
Page 3 of 4 (78 items) < Previous 1 2 3 4 Next > Previous Next