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

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

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

Post 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
Last edited by crocket on Thu Aug 08, 2019 9:54 pm, edited 1 time in total.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

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

Post 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.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

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

Post 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.
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

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

Post 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.
Last edited by crocket on Thu Aug 08, 2019 6:06 am, edited 3 times in total.
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

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

Post 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?
User avatar
turbidh20
Established Member
Posts: 190
Joined: Sun Aug 04, 2019 12:48 pm
Location: UK
Has thanked: 8 times
Been thanked: 2 times

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

Post 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:
Arch Linux (i7-4790k/GTX970); UMC204HD; MPK Mini MKII; Jack2 (QjackCtl) & Ardour/Mixbus
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

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

Post 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.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
turbidh20
Established Member
Posts: 190
Joined: Sun Aug 04, 2019 12:48 pm
Location: UK
Has thanked: 8 times
Been thanked: 2 times

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

Post 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.
Arch Linux (i7-4790k/GTX970); UMC204HD; MPK Mini MKII; Jack2 (QjackCtl) & Ardour/Mixbus
crocket
Established Member
Posts: 68
Joined: Fri Mar 29, 2019 11:56 am

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

Post 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.
Post Reply