ALSA: loop sound problem

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

Here's what I observe: after playing the sound, silence occurs, and then the sound plays again. I am 100% sure that the program itself does not play it again.

To continue the study, I did another experiment: with a game on the same board I played a different sound. This works great. Then I again completed the world program. This time in addition to the periodic sound, I heard the remains of another sound played by aplay.

I suspect that the buffer in alsa-lib or the sound driver is not cleared. Or that I may not have configured the program parameter correctly. snd_pcm_dump returns 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 note that I do not see any of this, I am running it under Ubuntu.

+3
source share
1 answer

I had some similar problems not using alsa-lib. But with alsa, I and ubuntu ts self. I found it painstakingly going through the drivers and testing them to be the best option, also using something like speaker-test -c2 -twav to help you. Regarding the implementation of your salsa, I don’t see anything to look at. But I am afraid without additional information. I can no longer help.

+1

Source: https://habr.com/ru/post/1767020/


All Articles