iliak's picture

OpenTK.Audio vs System.Media

What are the disadvantages and advantages ?

Disadvantages :
- need an external dll and possibly a hack (soft openal)
- no advanced parameters (dopler, 3D sound...)

Advantages :
- Included in the framework, no external dll
- easy asynchronous loading


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The two APIs target completely different audiences:

  • System.Media is a high-level API provides basic support for playing back sounds and audio file. It's fine if you just wish to play a sound file but gives you little control over the process: you can forget about streaming or effects like cross-fading, rever, panning/positional audio.
  • OpenTK.Audio is low-level 3d audio API (OpenAL) which (a) gives you complete control over playback and (b) can use hardware acceleration, given a suitable sound card and drivers. Almost everything is up to you: decoding the audio files, buffering the data, setting playback parameters, channels and effects.

In general, you'd use System.Media if you wanted to add sound to a desktop application ('clicks', 'dings', 'bells' when interacting with the interface), while you'd use OpenTK.Audio if you wanted to create a game with non-trivial audio. Many AAA games rely on OpenAL for audio (Bioshock, Mass Effect immediately spring to mind).

You can assume that OpenAL is supported out of the box in all modern Linux distributions (via OpenAL Soft), as well as Mac OS X. For Windows, you generally need to install the OpenAL redist, available from Creative's website.