Page 1 of 1

[OBSOLETE] line-out / line-in vs SPDIF out / SPDIF in

Posted: Wed Aug 07, 2019 6:39 am
by crocket
I want to share a pair of speakers with two computers.
Which setup is going to avoid pops, clicks, and xruns?
--> // connection that's not between two computers
==> // connection between two computers
It is assumed that the computer that has speakers runs both JACK server and JACK clients that connect to the JACK server.
JACK server runs on Raspberry Pi 3 B+.
  • Onboard line-out ==> USB soundcard line-in --(alsa_in)--> JACK server --> USB/I2S Amp --> speakers
  • Onboard line-out --> USB soundcard line-in --(alsa_in)--> netjack1 ==(ethernet)==> JACK server --> USB/I2S Amp --> speakers
  • Onboard SPDIF out ==> USB soundcard SPDIF in --(alsa_in)--> JACK server --> USB/I2S Amp --> speakers
  • Onboard SPDIF out --> USB soundcard SPDIF in --(alsa_in)--> netjack1 ==(ethernet)==> JACK server --> USB/I2S Amp --> speakers
  • Onboard SPDIF out ==> I2S SPDIF in --> JACK server --> I2S SPDIF out --> SPDIF in on Amp --> speakers

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Wed Aug 07, 2019 10:33 am
by bluebell
Since so many desktop applications use Pulseaudio maybe you might rethink your "no Pulseaudio" descision, at least on the desktop PC.

On the desktop PC,
ALSA client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
and
Pulseaudio client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
should work without noises.

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Wed Aug 07, 2019 11:30 am
by crocket
bluebell wrote:Since so many desktop applications use Pulseaudio maybe you might rethink your "no Pulseaudio" descision, at least on the desktop PC.

On the desktop PC,
ALSA client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
and
Pulseaudio client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
should work without noises.
Since I use gentoo linux, only torbrowser, which comes as a binary package, requires pulseaudio which I can mimic with apulse.
Even firefox uses ALSA on my system.

I like the control I have with ALSA and JACK. With pulseaudio, it would be difficult to tweak latency. I want low latency. If it took a USB soundcard or an I2S soundcard to get lossless sound at low latency, I would buy it.

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 12:09 am
by crocket
bluebell wrote:Since so many desktop applications use Pulseaudio maybe you might rethink your "no Pulseaudio" descision, at least on the desktop PC.

On the desktop PC,
ALSA client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
and
Pulseaudio client -> Pulseaudio -> netjack -> LAN/WLAN -> netjack -> jack -> ALSA (low level) -> audio device
should work without noises.
By the way, I just tested pulseaudio.

Configuration

~/.asoundrc

Code: Select all

pcm.!default {
  type pulse
}

ctl.!default {
  type pulse
}
~/.pulse/default.pa

Code: Select all

load-module module-native-protocol-unix
load-module module-jack-sink client_name=pulseaudio-sink channels=2 connect=no
load-module module-null-sink
set-default-sink jack_out
~/.pulse/daemon.conf

Code: Select all

default-sample-format = s16le
default-sample-rate = 48000
realtime-scheduling = yes
exit-idle-time = -1
Result

Code: Select all

> pulseaudio
W: [pulseaudio] module-jack-sink.c: JACK error >Cannot use real-time scheduling (RR/85)(1: Operation not permitted)<
W: [pulseaudio] module-jack-sink.c: JACK error >JackClient::AcquireSelfRealTime error<

Code: Select all

> pacmd list-sink-inputs
1 sink input(s) available.
    index: 22
        driver: <protocol-native.c>
        flags: START_CORKED
        state: RUNNING
        sink: 0 <jack_out>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 74.67 ms
        requested latency: 0.50 ms
        sample spec: float32le 2ch 48000Hz
        channel map: front-left,front-right
                     Stereo
        resample method: (null)
        module: 0
        client: 58 <Vivaldi>
        properties:
                application.icon_name = "chromium-browser"
                media.name = "Playback"
                application.name = "Vivaldi"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "32"
                application.process.id = "12044"
                application.process.user = "guardian"
                application.process.host = "gentoo"
                application.process.binary = "vivaldi-bin"
                application.language = "en_US.utf8"
                window.x11.display = ":0"
                application.process.machine_id = "7f73b350d7095e87befc395658f8a3d5"
Latency fluctuates between 60ms and 100ms.
Jack frequently reported xruns from pulseaudio jack sink. In a sense, it is more unstable than alsa_in reading from ALSA loopback.

Conclusion

Pulseaudio jack sink is worse than alsa_in reading from ALSA loopback. It seems I need a proper soundcard to end this problem.

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 5:40 am
by crocket
Right now, I am attracted to

ALSA dmix --> Onboard SPDIF out --> USB soundcard SPDIF in --(alsa_in)--> netjack1 ==(ethernet)==> JACK server --> USB/I2S Amp --> speakers

As long as netjack1 receives clean audio, there will be no noise. But, I haven't tested this setup.
Has anyone tried a similar setup? Would it be ok?

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 4:19 pm
by turbidh20
Apologies for offtopic...
bluebell wrote:Since so many desktop applications use Pulseaudio maybe you might rethink your "no Pulseaudio" descision, at least on the desktop PC.
I've been using Linux for 13 years and never needed Pulseaudio :wink:

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 5:33 pm
by bluebell
turbidh20 wrote:Apologies for offtopic...
bluebell wrote:Since so many desktop applications use Pulseaudio maybe you might rethink your "no Pulseaudio" descision, at least on the desktop PC.
I've been using Linux for 13 years and never needed Pulseaudio :wink:
I am using Linux for 24 years, never liked Pulseaudio, but accepting it made life simpler. You can't kill all developers who use Pulseaudio in their clients. I am using it as a bridge to jack only, not more, not less.

Re: line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 5:39 pm
by turbidh20
bluebell wrote:I am using Linux for 24 years, never liked Pulseaudio, but accepting it made life simpler. You can't kill all developers who use Pulseaudio in their clients. I am using it as a bridge to jack only, not more, not less.
Of course, you use what works for you, Linux gives us those choices.

I actually wish I'd been using Jack for years, it's configurability is amazing. I had no idea how good it is.

Re: [OBSOLETE] line-out / line-in vs SPDIF out / SPDIF in

Posted: Thu Aug 08, 2019 9:56 pm
by crocket
Forget about pulseaudio jack sink because it is worse than alsa_in reading from ALSA loopback according to my test.
I realized I need more information on SPDIF. I made a new thread about it.