开发者

OpenAL and Popping Artifacts

开发者 https://www.devze.com 2023-02-17 15:21 出处:网络
I am using OpenAL for a music app for iPad. It has worked fine before, but now, after updating my device to iOS 4.3, there are popping/crackling noises on playback. They become apparent when multiple

I am using OpenAL for a music app for iPad. It has worked fine before, but now, after updating my device to iOS 4.3, there are popping/crackling noises on playback. They become apparent when multiple samples are played (i.e开发者_StackOverflow中文版. chords), and happen at the beginning of a new sample, after the 1st or 2nd sample has already been played. Besides these artifacts, the rest of the audio output is normal.

I buffer audio data for each instrument, create a source for each sound to be played, and attach the source to a cached buffer. The buffer is attached to a sample of audio data by using alBufferDataStaticProc()

I have also changed AL_FREQUENCY of the AL context to match the sampling frequency of the files (16 khz), but that only fixes the issue when the sample (source) to be played has an AL_PITCH value of 1. So what's certain is that if you change AL_PITCH, you change the output frequency of the source, which will not match the output frequency of the AL context, causing the problem

Some of the code is borrowed from Finch, which does a lot of data initialization. Here is a URL to the source code: https://github.com/zoul/Finch

I look forward to any pointers.


They become apparent ... after the 1st or 2nd sample has already been played

Could it be that you're adding unintialised data to the buffer? Possibly as a result of queuing an array that was not fully filled.

0

精彩评论

暂无评论...
验证码 换一张
取 消