artifacts and other OpenAL issues

When using the OpenAL library for audio output, you might experienced playback problems such as sound artifacts, “clicks”, volume problems, etc. Here a list of hints that might help:

  • Always set the correct gain, position, etc _BEFORE_ calling alSourcePlay(). Otherwise OpenAL might output the first milliseconds of the sound on a totally wrong position using a wrong gain, etc.
  • Always check for errors when creating new sources. If you blindly use an invalid source you might hear the sound from some weird position or you might not hear it at all. Make sure your error handling code addresses all possible issues.
  • Ensure that your sound files (e.g. WAV) aren’t broken. I once used a wav sound that worked well in players like VLC but in OpenAL it just played at full gain all the time, no matter what distance I set. The solution was to edit the wav and to reduce the overall volume of the sound into a valid range.

To be extended some day..

Advertisements

2 Responses to “artifacts and other OpenAL issues”


  1. 1 Shane Vitarana September 25, 2008 at 6:37 am

    I’d love to see the extension to this post πŸ™‚

    I’m having an issue where I hear “clicks” when playing the same sound concurrently, offset by a slight amount. The code is apparently stopping the source and replaying it, yet I experience artifacts.

  2. 2 adrianhenke September 28, 2008 at 9:32 pm

    So you use the same buffer and two sources concurrently playing it? The state of one source should not affect another source (in theory). Though what you could try:

    #1
    If you have a couple of OpenAL calls that modify multiple objects, you can try wrapping them between

    alcSuspendContext(context);
    // your openal calls here..
    alcProcessContext(context);

    This ensures that processing stops while you re-organize your sources, etc. I do this once inside the main ‘audio update’ method that re-positions all sources.

    #2
    If this is a bug in the OpenAL implementation you use, you might want to try a workaround: Instead of using the same buffer, use a second one as workaround. Just to see if it would fix it.

    #3
    Try a different implemenatation, see
    http://kcat.strangesoft.net/openal.html
    πŸ˜›


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: