Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    19

    Line input with direct/mixed playback on piCorePlayer?

    I have piCorePlayer running with an I2S amp hat but I'd like to play from an analogue input as well via an I2S or USB ADC. PCP has a neat option to stream output from a local ALSA input on the network but I want to play the stream directly on the local player, so it works with low latency and appears like the line input works on the Squeezebox Radio for example. I've searched on the forum but not found a solution (e.g., WaveInput plugin is no help since I run LMS on another machine). Has anyone done this already in a neat way, integrated with LMS or not?

    I've been messing with the snd_aloop module and setting squeezelite to play to a loopback device, then starting/stopping alsaloop processes to switch between the line in capture and the squeezelite player which (handily) continues playing. Maybe it's possible instead to mix the two streams but I know pCP tries to discourage dmix devices that do automatic sample rate conversion.

    Thanks in advance for any tips/thoughts!

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,609
    Behringer UAC202 is a cheap but very capable USB ADC/DAC that will do what you want to a point.

    The RCA audio in can be switched (monitor on) to also feed directly out via the RCA out while also being available to the Pi via USB.

    I have one connected to Tape IN/OUT on my amp which I use with a laptop to needledrop LPs - this is set to monitor OFF.

    I have another configured with monitor ON that is connected to a line out on amp1 and line in on another (amp2) and also to a Pi. This mode takes the audio out from amp1 and makes it playable on amp2 but also the Pi simultaneously. The pi isn’t installed with pcp. Instead it has Raspbian, Liquidsoap and Icecast2 which provides a playable Ogg/FLAC stream which I can “tune in URL” and play in LMS. There is however 1-2 seconds latency and as soon as you try to stream an alsa input you will get some degree of latency.

    The second option may well work for you if you want to play an analogue source to an analogue input but also want to use it as an output from a pCP player.

    The Behringer is 16/48 max
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  3. #3
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,609
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Posts
    19
    Quote Originally Posted by d6jg View Post
    Behringer UAC202 is a cheap but very capable USB ADC/DAC that will do what you want to a point.

    The RCA audio in can be switched (monitor on) to also feed directly out via the RCA out while also being available to the Pi via USB.
    d6jg, thanks for the suggestion and description of your set up!

    In fact I have a UAC222 already, it is the second thing I've tried to provide line in.(*)

    But because I'm using a digital input power amp with the Pi, building a desktop all-in-one amp, the Behringer UCA222 monitor RCA out is no use to me, hence the experiments with digital loop back. It seems a bit clunky/glitchy though, so I am wondering if starting with a digital input amp hat on the Pi causes more trouble than it's worth. Some commercial "fully-digital" amps manage this OK so I was hopeful -- I have a neat little Sabaj A3 which has USB DAC, optical, BT inputs as well as RCA analogue with reasonable quality. Not sure if the microntroller inside that merely switches I2S inputs or does some DSP itself, but obviously it isn't running a full OS.

    (*) after a failed attempt to connect a PCM1802 I2S ADC module (needs master clock)

  5. #5
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,609
    Quote Originally Posted by justi View Post
    d6jg, thanks for the suggestion and description of your set up!

    In fact I have a UAC222 already, it is the second thing I've tried to provide line in.(*)

    But because I'm using a digital input power amp with the Pi, building a desktop all-in-one amp, the Behringer UCA222 monitor RCA out is no use to me, hence the experiments with digital loop back. It seems a bit clunky/glitchy though, so I am wondering if starting with a digital input amp hat on the Pi causes more trouble than it's worth. Some commercial "fully-digital" amps manage this OK so I was hopeful -- I have a neat little Sabaj A3 which has USB DAC, optical, BT inputs as well as RCA analogue with reasonable quality. Not sure if the microntroller inside that merely switches I2S inputs or does some DSP itself, but obviously it isn't running a full OS.

    (*) after a failed attempt to connect a PCM1802 I2S ADC module (needs master clock)
    Unless you want to re-stream the RCA source I'm not sure what you gain by involving the Pi in the chain at all - would it not simpler to do RCA from source direct to power amp and Pi direct via USB to your Sabaj A3?

    Is it the "mixing input" that you are after? If so have you tried connecting the Behringer thus?

    RCA from source to RCA IN on UCA222
    Optical out from Behringer to Optical in on your power amp
    USB to Pi and configure pCP to use as output only - I don't think you want to stream the RCA IN do you?

    In my experience I have never managed to get a pCP to successfully work with an ADC/DAC in both modes as like you I found the "switching" aspect was troublesome. Solution - A Pi dedicated to do the line in job but in my case re-streaming to LMS.
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  6. #6
    Junior Member
    Join Date
    Nov 2012
    Posts
    19
    Quote Originally Posted by d6jg View Post
    Unless you want to re-stream the RCA source I'm not sure what you gain by involving the Pi in the chain at all - would it not simpler to do RCA from source direct to power amp and Pi direct via USB to your Sabaj A3?
    Thanks for providing suggestions. Sabaj is used in another room however (has a Touch connected there as well as TV box, standalone pCP also works well over USB on it).

    What I'm trying to do now is build a small, efficient one-box always-on desktop amp which embeds a squeezeplayer (and potentially an LMS server) but can also play sound from other sources. The main other source is a desktop Mac connected to another audio interface used for recording instruments -- hopefully this explains why I'm mentioning low latency and mixing! And yes, streaming local line in to other places is not really needed/wanted.

    Quote Originally Posted by d6jg View Post
    In my experience I have never managed to get a pCP to successfully work with an ADC/DAC in both modes as like you I found the "switching" aspect was troublesome. Solution - A Pi dedicated to do the line in job but in my case re-streaming to LMS.
    Thanks, this is useful to know. I guess the switching can be solved by invoking scripts on pCP via buttons even if no UI for it. More worrying is that in my experiments so far (on a Pi 3B, latest pCP) the alsaloop process sometimes has buffer underruns and seems to not always recover from them - so sound gets mangled until the process is restarted. It has a parameter to tune the desired latency but it didn't seem to help.

    This recent article by HiFiBerry hints that alsaloop might be less reliable going across USB/i2S boundary:

    https://www.hifiberry.com/docs/softw...sing-alsaloop/

    I think my options are:

    1. Stick with alsaloop and USB ADC, make it robust as possible on pCP
    2. See if things are any better on another pi OS (HiFiBerry points to dedicated audio OS by Elk Audio, not sure if LMS/squeezelite available there though)
    3. Buy different hardware to build in, HiFiBerry DAC+ADC and/or analogue input amp (or DSP to mix I2S?)
    4. Try a low-latency streaming solution from desktop PC over Ethernet (giving up on analogue input but serving main use)


    Last option maybe a bit far-fetched -- Trx looks promising (http://www.pogo.org.uk/~mark/trx/) but would need to port to Mac as well as compile on pCP.

    Of course I could just give up on this and connect a new separate standalone amp like the Sabaj to a standalone squeezeplayer and the other audio interface, to make life simpler! But my all-in-one desktop amp thing is half built now and in a nice case...

  7. #7
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,609
    Sounds like a fun project
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

Posting Permissions

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