0

I recently installed a JustBoom DAC HAT on my Raspberry Pi 3, but I can't make it play a sound by using ALSA or PulseAudio. alsamixer lets me configure the HAT, apparently without problems, but test-speaker complains it can't access the sound device (ALSA) or can't connect to the PulseAudio server when it's running (connection refused).

Here are the steps I've taken after installing the HAT:

  1. Removed the on-board sound device from /boot/config.txt:

    dtparam=audio=off dtoverlay=justboom-dac

  2. Used the following .asoundrc for ALSA:

    pcm.!default { type hw card 0 device 0 }

    ctl.!default { type hw card 0 }

…and for PulseAudio:

pcm.!default {
  type plug
  slave {
    pcm "hw:1,0"
  }
}

ctl.!default {
  type hw
  card 0
}
  1. For PulseAudio, changed the /etc/pulse/default.pa file as follows:

    load-module module-native-protocol-tcp load-module module-zeroconf-publish

  2. Ran alsamixer and set volumes of both channels to 100%. For PulseAudio, I started the server as daemon (which started without errors): pulseaudio -D

  3. Ran speaker-test, which crashed both in the ALSA, and in the PulseAudio config: With PulseAudio, it said:

    pi@autoradio:~ $ speaker-test

    speaker-test 1.0.28

    Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

    Playback open error: -111,Connection refused

What's wrong here? Does anybody have a hint for me? Thank you.

UPDATE: Using ALSA in debug mode (by adaprint the /etc/libao.conf file) and trying to play an OGG sound file, I get this:

pi@autoradio:/import/valen/autoradio $ ogg123 -v Emergency_Alert_System_Attention_Signal_20s.ogg
debug: Loaded driver null (built-in)
debug: Loaded driver wav (built-in)
debug: Loaded driver raw (built-in)
debug: Loaded driver au (built-in)
debug: Loading driver plugins from /usr/lib/ao/plugins-4...
debug: Loaded driver oss
debug: Loaded driver pulse
debug: Loaded driver nas
debug: Loaded driver esd
debug: Loaded driver alsa
debug: Testing drivers to find playback default...

Audio Device:   Advanced Linux Sound Architecture (ALSA) output
Author:   Bill Currie <bill@taniwha.org>/Kevin Cody, Jr. <kevinc@wuff.dhs.org>
Comments: Outputs to the Advanced Linux Sound Architecture version 0.9/1.x

Playing: Emergency_Alert_System_Attention_Signal_20s.ogg
Ogg Vorbis stream: 1 channel, 44100 Hz
Vorbis format: Version 0
Bitrate hints: upper=-1 nominal=96000 lower=-1 window=0
Encoded by: Xiph.Org libVorbis I 20030909
Encoder: Cool Edit
ao_alsa debug: Trying to open ALSA device 'default'
ao_alsa debug: snd_pcm_hw_params_set_channels() failed.
ao_alsa debug: Unable to open ALSA device 'default'
ao_alsa ERROR: Unable to open ALSA device 'default' for playback => Invalid argument
ERROR: Cannot open device alsa.
  • To rule out the obvious have you rebooted? – Steve Robillard Nov 20 '17 at 0:12
  • Sure I have, even several times! – Neppomuk Nov 20 '17 at 20:08
1

OK, after consulting quite a detailed tutorial, I've managed to find a solution myself, which looks like this: I added a virtual "plug" device to my ALSA config, which allows for playback of mono soundtracks:

pcm.!default {
  type plug

  slave {
    pcm "hw:0,0"
    format S32_LE
    channels 2
    rate 192000
  }
}

ctl.!default {
        type hw
        card 0
}

Explanation: The default device is now a "plug" device, which itself uses the JustBoom card (hw:0,0) as a slave. The two output channels are stated in the config, so that a mono sound stream can be duplicated (otherwise I would continue getting this lousy error message). The other lines (32 bit width + 192 kbit/s sampling rate) have been added for better sound quality.

I put this config into the /etc/asound.conf config file and deleted the .asoundrc files.

What I also had to do, was to reduce the volume of the "digital" output to 40% in order not to overscan, thereby causing a very distorting sound.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.