Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Playing raw audio samples

Playing raw audio samples

Scheduled Pinned Locked Moved C#
questioncsharpgraphicsgame-devperformance
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Williams
    wrote on last edited by
    #1

    How do I? Or, to be a little more precise, I would like to suck homemade audio samples from an buffer (e.g., noise might be a gaussian distribution of integers between + -32K)and feed them at the right rate to a soundcard (audio device) for real-time play. (I'm not trying to play an existing, saved wav file.) A simple application would be a VCO (oscillator with a slider controlling the frequency). In the .net world, is this done by DirectX? By the WINAPI? wavePlay? Magic? Not at all? Background note: a wavetable might contain one complete waveform of a sample, and the buffer might have as many repetitions of the sample as maching performance allows.

    L 1 Reply Last reply
    0
    • D David Williams

      How do I? Or, to be a little more precise, I would like to suck homemade audio samples from an buffer (e.g., noise might be a gaussian distribution of integers between + -32K)and feed them at the right rate to a soundcard (audio device) for real-time play. (I'm not trying to play an existing, saved wav file.) A simple application would be a VCO (oscillator with a slider controlling the frequency). In the .net world, is this done by DirectX? By the WINAPI? wavePlay? Magic? Not at all? Background note: a wavetable might contain one complete waveform of a sample, and the buffer might have as many repetitions of the sample as maching performance allows.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Have a look at my article http://www.codeproject.com/useritems/nBASS.asp[^]. That is one feature I havent tested yet, but the BASS API can do that. (just had a look, and I havent done that yet :( havent had a need really, but you can load from a short[](16-bit) and play that. It is something I have been playing with recently, so it mite not be in the version on CP. Give me shout if its not there. Look for these functions: nBASS.BASS.LoadStream that takes a short[] as a parameter. Cheers :) PS: If you can mail me a "RAW" audio file, I will try make it work. :) Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups