2

For my school project I would like to know if anyone can help me in finding a way of outputting sound in real time through the speakers of my PC. This has to be donevia my sound Card while at the same time playing with parameters of the signal being played such as phase, amplitude, waveform etc? I would prefere a library under the C++ language if possible and on the Windows plateform for practical reasons. Ofcourse Linux is also possible.

Most importantly I would also like to send a different waveforms through each speaker as to create stationary waves as can be seen through this experiment: www.youtube.com/watch?v=T56waxJ7bB8

2 Answers2

1

One interesting possibility is to use JACK. It works under Linux, Windows and OSX and provides low-latency access to audio output. It also allows for the output to be arbitrarily routed to some other program.

JACK's programming model is very simple - the only kind of data supported is a single channel of 32-bit floats, so rather than fiddling with manually interleaving data channels, you can instead provide separate instances of left and right audio sine wave generators and route each to the appropriate output channel.

Also, as a minor point of interest, JACK2 is written in C++ (although the external API is still C). I'd recommend starting with the JACK wiki and perhaps modifying one of the simple example clients to do what you're attempting.

Edward
  • 6,964
  • 2
  • 29
  • 55
0

There are a few APIs to do this.

  • For Windows XP and up use DirectSound
  • For Windows Vista/7/8 and up use WASAPI
  • There are some cross-platform APIs like OpenAL and SDL.

Search the web for some examples. Play around with those APIs and examples for a while and see how you do.

Moby Disk
  • 3,761
  • 1
  • 19
  • 38