DSPRelated.com
Forums

Playback on speaker using ping-pong buffers

Started by Sanjam March 19, 2007
Hi all
I am working on playing a AAC decoded file on the speaker side on a
ADSP board.
To begin with , I have simply take a PCM buffer and am trying to play it
on the speaker.
I am using ping -pong buffer implementation wherein I am first writing
data to buffer. Then through DMA , I am transferring this data to DAC
which is connected to speaker. While this buffer is being played on
speaker , I am filling another buffer simultaneously . Once the first
buffer has finished playing, I play from the second buffer and
simultaneously fill the first buffer , and so on.
The problem with above implementation is that along with the actual
sound, there is a click-click sound as well.
If I do not use ping -pong buffers and rather play the big buffer in
single go, then sound is absolutely clear.
I was using buffers of 2K initially but I tried increasing there
sizes. Nothing is improving the quality.
Kindly let me know if anyone comes up with a different implementation.
Regards
Sanjam
On Mon, 19 Mar 2007, Sanjam wrote:

>
> Hi all
> I am working on playing a AAC decoded file on the speaker side on a
> ADSP board.
> To begin with , I have simply take a PCM buffer and am trying to play it
> on the speaker.
> I am using ping -pong buffer implementation wherein I am first writing
> data to buffer. Then through DMA , I am transferring this data to DAC
> which is connected to speaker. While this buffer is being played on
> speaker , I am filling another buffer simultaneously . Once the first
> buffer has finished playing, I play from the second buffer and
> simultaneously fill the first buffer , and so on.
> The problem with above implementation is that along with the actual
> sound, there is a click-click sound as well.
> If I do not use ping -pong buffers and rather play the big buffer in
> single go, then sound is absolutely clear.
> I was using buffers of 2K initially but I tried increasing there
> sizes. Nothing is improving the quality.
> Kindly let me know if anyone comes up with a different implementation.
> Regards
> Sanjam

Put in a single tone and watch it on a 'scope. Add a pulse from your dsp
to some unused i/o pin when you switch buffers. use the code that sends
the pulse in different places of your code to figure out what happens
before and after the click. You can at least track down the bug that way.
Fixing it is another problem!!

Patience, persistence, truth,
Dr. mike