views:

35

answers:

0

I have written a small program that tests the ALSA library on an Embedded Linux board. The program configures ALSA, plays a single sound and then waits 1 minute before exiting.

Here is what I am observing: after playing the sound, there is silent pause and then the sound is played again. I am 100% positive that the program itself is not playing it again.

To further investigate, I did another experiment: With aplay on the same board, I played a different sound. This worked fine. Next I executed my hello world program again. This time in addition to the periodic sound, I heard remnants other the sound played by aplay.

I suspect that a buffer either in alsa-lib or the sound driver is not getting cleared. Or that I might have not configured a software parameter correctly. snd_pcm_dump spits out the following information:

  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 32768
  period_size  : 2048
  period_time  : 256000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 32768
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824

I should also mention that I do not see any of this is I run it under Ubuntu.