Problem with synthesized output

Spencer Kohan spencerkohan at gmail.com
Sun Dec 13 15:11:15 CET 2020


Hello,

I hope I am posting this to the correct place.

I'm trying to use a Raspberry Pi as a wifi speaker, and as a first step I'm
trying to just play some sound out of a buffer through the attached amp.

I'm using an AMP2 with a RPi 4, and I'm getting some strange behavior when
I try to play any "sine" output.

So for instance, if I use `speaker-test`, I am able to play the wav test
and the pink-noise test just fine, but when I try to play the sine test, it
plays for like one quick instant, and then the program blocks.

What's strange is I get the exact same behavior when I use other methods to
try to play a sine output over ASLA.  For instance, if I use sox:

    play -n synth sine 1000

I get the same output: one quick blip of the tone, and then the program
blocks.  The output to the console looks like this:

    play WARN alsa: can't encode 0-bit Unknown or not applicable

    File Size: 0
    Encoding: n/a
    Channels: 1 @ 32-bit
    Samplerate: 48000Hz
    Replaygain: off
    Duration: unknown

    In:0.00% 00:00:00.00 [00:00:00.00] Out:0 [ | ] Clip:0

And then I get the exact same behavior when I try to do the `sio_sine`
example from [libsoundio](https://github.com/andrewrk/libsoundio), with
this output:

    Backend: ALSA
    ALSA lib pcm_dsnoop.c:575:(snd_pcm_dsnoop_open) The dsnoop plugin
supports only capture stream
    Output device: snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi
pcm512x-hifi-0: Default Audio Device
    Software latency: 0.008000
    'p\n' - pause
    'u\n' - unpause
    'P\n' - pause from within callback
    'c\n' - clear buffer
    'q\n' - quit
    unable to set channel layout: incompatible device

Also interesting, when I try the [rsoundio](
https://github.com/klingtnet/rsoundio) sine example, it reports an
underflow.

My output for aplay looks like this:

    $ aplay -L

null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0
Hardware device with all software conversions



It's just strange because the pre-recorded sample and the pink noise
version work just fine.  How would I even go about trying to debug this?


More information about the Alsa-devel mailing list