Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Allow Jukebox mode to play audio to a pipe for use with Snapcast #335

Open
MindrustUK opened this issue Dec 17, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@MindrustUK
Copy link

Scope

Other

What problem

I'd like to use Airsonic Advanced's Jukebox mode with SnapCast To provide multiroom audio playback.

At present main/java/org/airsonic/player/service/jukebox/AudioPlayer.java requires SourceDataLine line to be a physical audio device, My intention is to play to a pipe as per examples here as I have no Alsa/Pulse/Pipewire installed on the target server.

Feature

Remove requirement for a physical audio device in main/java/org/airsonic/player/service/jukebox/AudioPlayer.java as a jukebox output. Allow ffmpeg to play to a pipe instead.

@MindrustUK MindrustUK added the enhancement New feature or request label Dec 17, 2023
@masterblaster79
Copy link

masterblaster79 commented Jan 17, 2024

This is how it works for me through Alsa:
I am running airsonic in a LCX container running Debian without any soundcard.

Install snapserver and configure it:

# grep -Ev '^\s*#|^$' /etc/snapserver.conf
[server]
[http]
[tcp]
[stream]
source = pipe:///run/snapserver/snapfifo?name=default
sampleformat = 48000:16:2
[logging]

Configure Alsa to create a default device which in the end sends everything to the snapfifo pipe:

# grep -Ev '^\s*#|^$' /etc/asound.conf 
pcm.!default {
    type plug
    slave {
        pcm rate48000Hz # Direct default output to the below converter
    }
}
pcm.rate48000Hz {
     type rate
     slave {
          pcm writeFile # Direct to the plugin which will write to a file
          format S16_LE
          rate 48000
     }
}
pcm.writeFile {
    type file
    slave.pcm null
    file "/run/snapserver/snapfifo"
    format "raw"
}

This snippet let's systemd create the required directory

# cat /etc/tmpfiles.d/snapserver.conf
d /run/snapserver 0755 _snapserver _snapserver

As this is the default sound device, no further configuration on airsonic or java should be required.

Edit: I overlooked that you have no Alsa, what prevents you from installing it?

Edit 9th of Apr 2024: Use /run/snapserver/snapfifo instead of /var/snapfifo/snapfifo and also apply the required systemd tmpfiles snippet

@MindrustUK
Copy link
Author

Thanks for the reply, the above will work and there's nothing preventing me from installing Alsa I'm wanting to avoid installing any extraneous sound servers, Alsa, Pipewire, Pulseaudio etc. The reasoning for this is not to add additional resource (even if it's negligible by today's standards) and to limit the amount of "moving parts" so that in future should anyone be troubleshooting an installation it's one less thing to investigate.

@masterblaster79
Copy link

Fair enough.
However, if I am not wrong, you only need to install the alsa-utils and the snapserver package and put the config in place and that's it. There is no sound server. The only additional daemon is snapserver which is very lightweight.

@MindrustUK
Copy link
Author

I must confess I always thought alsa was a daemon. While it would still be nice to do this without any external libs what you've suggested is probably good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants