Home of the Squeezebox™ & Transporter® network music players.
Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22
  1. #21
    Junior Member
    Join Date
    Mar 2010
    Posts
    9

    Running DAC and analog audio from same RPi simultaneously

    Resurrecting this few years old thread...

    I'm running piCoreplayer on RPi 4B with Hifiberry AMP2 wired to passive shelf speakers. I thought of adding also subwoofer, but I would need another output for that. Of course I could have another synchronized RPi to drive the subwoofer, but this thread and some other examples I found from the internet made me think if I could make it work with just single Raspberry Pi.

    Namely Hifiberry AMP2 to drive shelf speakers and analog audio to run the subwoofer simultaneously.

    Reusing the configuration explained in this thread, my /etc/asound.conf looks like this:

    Code:
    pcm.!default {
      type plug
      slave {
        pcm "both"
      }
    }
    
    pcm.both {
      type route
      slave {
        pcm "multi"
        channels 4
      }
    
      ttable.0.0 1.0
      ttable.1.1 1.0
      ttable.0.2 1.0
      ttable.1.3 1.0
    }
    
    pcm.multi {
      type multi
      slaves.a {
        pcm "analog"
        channels 2
      }
      slaves.b {
        pcm "hifiberry"
        channels 2
      }
      bindings.0.slave a
      bindings.0.channel 0
      bindings.1.slave a
      bindings.1.channel 1
      bindings.2.slave b
      bindings.2.channel 0
      bindings.3.slave b
      bindings.3.channel 1
    }
    
    pcm.analog {
      type hw
      card 0
      device 0
      channels 2
    }
    
    pcm.hifiberry {
      type hw
      card 1
      device 0
      channels 2
    }
    And I have these devices

    Code:
    **** List of PLAYBACK Hardware Devices ****
    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
      Subdevices: 6/7
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
      Subdevices: 0/1
      Subdevice #0: subdevice #0
    On Squeezelite settings I had selected "both" as the output device. However, I cannot get audio from any of the outputs, and the playback doesn't even start. Looking at the debug messages, the first problem I had was that sample format (24_3) was not supported.

    Code:
    [11:07:35.681883] alsa_open:427 unable to open audio device requested format: S24_3LE
    I had to remove the sample format setting altogether to get forward (then it defaults to 16 bits). But then I'm getting other errors and no sound.

    Code:
    /usr/local/bin/squeezelite -n HifiBerry -o both -a 80:4::1: -d all=debug -f /var/log/pcp_squeezelite.log
    [11:19:08.326959] stream_init:370 init stream
    [11:19:08.327069] stream_init:371 streambuf size: 2097152
    [11:19:08.331204] output_init_alsa:939 init output
    [11:19:08.331268] output_init_alsa:979 requested alsa_buffer: 80 alsa_period: 4 format: any mmap: 1
    [11:19:08.331338] output_init_common:350 outputbuf size: 3528000
    [11:19:08.331481] output_init_common:374 idle timeout: 0
    [11:19:08.339606] output_init_common:422 supported rates: 192000 176400 96000 88200 48000 44100 32000 16000 11025 8000
    [11:19:08.353873] output_init_alsa:1005 memory locked
    [11:19:08.353941] output_init_alsa:1011 glibc detected using mallopt
    [11:19:08.354319] output_thread:687 open output device: both
    [11:19:08.354329] output_init_alsa:1031 set output sched fifo rt: 45
    [11:19:08.354359] alsa_open:351 opening device at: 44100
    [11:19:08.357014] alsa_open:422 opened device both using format: S16_LE sample rate: 44100 mmap: 1
    [11:19:08.357347] alsa_open:513 buffer: 80 period: 4 -> buffer size: 3536 period size: 884
    [11:19:08.371263] ALSA hw_link:815 SNDRV_PCM_IOCTL_LINK failed (-77)
    [11:19:08.384513] decode_init:154 init decode
    [11:19:08.384825] register_dsd:908 using dsd to decode dsf,dff
    [11:19:08.416635] load_ff:685 loaded libavcodec.so.57 (57.48.101)
    [11:19:08.416688] load_ff:702 loaded libavformat.so.57 (57.41.100)
    [11:19:08.416704] load_ff:716 loaded libavutil.so.55 (55.28.100)
    [11:19:08.416857] register_ff:795 using ffmpeg to decode alc
    [11:19:08.416871] register_ff:779 using ffmpeg to decode wma,wmap
    [11:19:08.417394] load_faad:611 loaded libfaad.so.2
    [11:19:08.417411] register_faad:641 using faad to decode aac
    [11:19:08.418104] load_vorbis:348 loaded libvorbisfile.so.3
    [11:19:08.418119] register_vorbis:377 using vorbis to decode ogg
    [11:19:08.418967] load_opus:291 loaded libopusfile.so.0
    [11:19:08.418981] register_opus:320 using opus to decode ops
    [11:19:08.419494] load_flac:286 loaded libFLAC.so.8
    [11:19:08.419507] register_flac:314 using flac to decode ogf,flc
    [11:19:08.419517] register_pcm:433 using pcm to decode aif,pcm
    [11:19:08.420267] load_mad:385 loaded libmad.so.0
    [11:19:08.420281] register_mad:414 using mad to decode mp3
    [11:19:08.420290] decode_init:195 include codecs:  exclude codecs:
    [11:19:08.420725] discover_server:788 sending discovery
    [11:19:08.515484] discover_server:799 got response from: 192.168.1.100:3483
    [11:19:08.515614] slimproto:887 connecting to 192.168.1.100:3483
    [11:19:08.517964] slimproto:926 connected
    [11:19:08.518011] sendHELO:142 mac: dc:a6:32:b3:d1:c9
    [11:19:08.518036] sendHELO:144 cap: CanHTTPS=1,Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=v1.9.6-1206-pCP,ModelName=SqueezeLite,MaxSampleRate=192000,dsf,dff,alc,wma,wmap,aac,ogg,ops,ogf,flc,aif,pcm,mp3
    [11:19:08.524268] process:521 strm
    [11:19:08.524299] process_strm:274 strm command q
    [11:19:08.524321] decode_flush:237 decode flush
    [11:19:08.524343] output_flush:435 flush output buffer
    [11:19:08.524370] sendSTAT:189 STAT: STMf
    [11:19:08.525408] process:521 strm
    [11:19:08.525439] process_strm:274 strm command q
    [11:19:08.525461] decode_flush:237 decode flush
    [11:19:08.525481] output_flush:435 flush output buffer
    [11:19:08.525506] sendSTAT:189 STAT: STMf
    [11:19:08.525637] process:521 setd
    [11:19:08.525666] sendSETDName:248 set playername: HifiBerry
    [11:19:08.526040] process:521 setd
    [11:19:08.526645] process:521 aude
    [11:19:08.526673] process_aude:415 enable spdif: 1 dac: 1
    [11:19:08.527032] process:521 audg
    [11:19:08.527059] process_audg:433 audg gainL: 0 gainR: 0 adjust: 1
    [11:19:08.527083] set_volume:233 setting internal gain left: 0 right: 0
    [11:19:09.395554] output_thread:773 pcm wait timeout
    [11:19:09.395697] ALSA snd_pcm_hw_prepare:659 SNDRV_PCM_IOCTL_PREPARE failed (-16)
    [11:19:09.409432] ALSA snd_pcm_recover:8435 cannot recovery from underrun, prepare failed: Device or resource busy
    [11:19:09.409471] output_thread:746 recover failed: Device or resource busy
    [11:19:09.409522] output_thread:763 start error: File descriptor in bad state
    [11:19:09.419607] output_thread:763 start error: File descriptor in bad state
    [11:19:09.429695] output_thread:763 start error: File descriptor in bad state
    ...
    Any hints what could be the problem?

    I'm running piCorePlayer 6.1.0.
    Last edited by hmaki; 2020-09-08 at 01:32.

  2. #22
    Junior Member
    Join Date
    Mar 2010
    Posts
    9
    I didn't get analog+hifiberry working at the same time, but when I tried with USB DAC I did get sound out. Only the volume of the USB DAC is very low when compared using that as the only output.

    Not sure how ALSA controls the volume and if there is something needed there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •