FAQ

Why does audio stutter with ALSA?

Some hardware defaults ALSA to a very small buffer. ALSA counts buffer_size and period_size in frames, and a 44.1 kHz stream has 44,100 frames per second (one frame holds one sample per channel). With the defaults below, a period of 441 frames is 10 ms, so ALSA wakes the player 100 times a second, and the whole buffer of 1323 frames holds only 30 ms of audio. Small buffers suit low-latency games and instruments, not streaming: the player can't refill the buffer fast enough, and snd_pcm_writei() returns -EPIPE.

Alsa initialized, buffer_size: 1323 period_size: 441

Use a much larger buffer. The ALSA implementation in src/audio_output_alsa.c in the SDK package sets a buffer of 88,200 frames (2 seconds), split into 4 periods of 22,050 frames (0.5 seconds each):

Alsa initialized, buffer_size: 88200 period_size: 22050

Can we run multiple instances of the SDK per device?

The SDK supports running multiple, independent instances on a single device, provided the following conditions are met:

  • Audio hardware support: The host device must be capable of mixing and playing back multiple audio streams simultaneously.
  • Unique storage paths: Each SDK instance must be configured with its own data directory and cache directory (such as diskcache_dir in splayer_config_t).

Can we run multiple sound zones on a single SDK instance?

No. One SDK instance is connected to exactly one sound zone and plays only that zone's music. To play several zones from one device, run one instance per zone, as described above. To play the same music throughout a venue, use one sound zone and distribute its audio through the venue's own sound system.

Why does the player fail to load with an older libstdc++ on the target?

If the libc, libstdc++ and ld on your target are older than the ones in the toolchain the Player Library was built with, loading fails with errors like these:

./libSplayer_alsa: /lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by libSplayer.so)
./libSplayer_alsa: /lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by libSplayer.so)
./libSplayer_alsa: /lib/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by libSplayer.so)
./libSplayer_alsa: /lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by libSplayer.so)

If needed, we can link libstdc++ statically to avoid most of the issues, but your target platform needs a compatible libc.so. Use the same version of libc and libstdc++ on your target as in the toolchain that you provide us. For Linux, you can create them using Yocto or Buildroot. The Player Library uses C++11 atomics, and some GCC toolchains put these in a separate library called libatomic.so. This library is required on the device for our player to run.