Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide Stream audio from linux (pipewire) to moode via AirPlay (shairport-sync)
#1
Information 
This may be common knowledge to some, but I've just started learning my way around network streaming and one of the things I wanted to do was while watching videos on my linux box, I want the audio cast to my network streamer. After searching the net, I landed on an instruction (scroll down halfway) over pipewire's support over at gitlab. While it does what I wanted, there is a bit finetuning needed to make it a better experience. So, here are the steps I went through to get mine working on casting audio to moode:
  1.  On your linux client pc, edit ore create $HOME/.config/pipewire.pipewire.conf.d/pipewire.conf by adding these lines:
    Code:
    ...
    context.modules = [
    ...
       {   name = libpipewire-module-raop-sink
           args = {
                raop.hostname = xxx.xxx.xxx.xxx ##Your moode's ip
                raop.port = 7000  ##use 5000 for Airplay1 and 7000 for airplay2
                stream.props = "Moode AirPlay" tsched=0 fixed_latency_range=no fragments=12 fragment_size=1024
                raop.transport = udp
                raop.audio.codec = PCM
                audio.format = S16
                audio.rate = 44100
                audio.channels = 2
                audio.position= [ FL FR ]
                node.latency = 352/44100
                node.name = Moode AirPlay
                node.description = Moode AirPlay
           }
       }
    ...
    ]

  2. Restart your pipewire and pipewire-pulse services

    Code:
    systemctl restart pipewire
    systemctl restart pipewire-pulse

    ##If you are running from user level
    systemctl --user restart pipewire
    systemctl --user restart pipewire-pulse
  3. wait for the services to restart and create the sink
  4. Select that sink as audio output from the volume control or audio device control panel. Try playing a video and see if the volume is adequate. If it is, then you are done. In my case, the output is so low, it is inaudible unless you crank up all the way on both sides.. So, we need to do some config editing on shairport-sync.conf file
  5. SSH to your moode server via terminal or the web SSH of moode player's system config's page. Login and edit shairport-sync.conf
    Code:
    sudo nano /etc/shairport-sync.conf


  6. Look for // ignore_volume_control = "no";....... line. Remove the two "//" and change no to yes (quotes intact). As indicated in the explanation, this will force the audio output on the server to be 100 and you have to control the volume on your client side.  Save the file and restart on the terminal or in moode player's renderers config page
    Code:
    sudo systemctl restart shairport-sync


  7. First lower the volume on your linux client and try playing a video. It may take a second or two to connect. If it seems out-of-sync, stop the video and press play again to see if it is in-sync. You can adjust the latency in Airplay's setting on moode player's renderers page.
That's it! I don't know if this is specific to linux, but you may experience some quirkiness when casting to airplay from linux. On my box, clicking on the volume icon on the task bar seems to force connection to airplay, so any playback on moode will be interrupted. Occasionally, the sound becomes choppy or garbled. In this situation, just press pause and then resume playback to let it go back to normal.

Have fun!  Smile

NOTE: If you haven't done it already, you need to open port 6001 for UDP connection on your firewall for this connection.
Reply
#2
Recent update to pipewire has made the above configuration unusable and in fact will cause your audio device not to show up. So following the format suggested in pipewire's documentation, here is the updated configuration a bit streamlined:

Code:
context.modules = [
   {   name = libpipewire-module-raop-sink
       args = {
            raop.ip = "xxx.xxx.xxx.xxx"
            raop.port = 7000
            stream.props = "Moode AirPlay" tsched=0 fixed_latency_range=no fragments=12 fragment_size=1024
            raop.transport = "udp"
            audio.format = "S16"
            node.latency = 352/44100
            node.name = Moode AirPlay
            node.description = Moode AirPlay
       }
   }
]
Reply
#3
@fushark
Thank you for sharing this! I added your settings and worked flawlessly...

In case it helps other users. In my case I edited the file "/usr/share/pipewire/pipewire.conf" instead of "$HOME/.config/pipewire.pipewire.conf.d/pipewire.conf".
Important to "add" the code provided by @fushark under the "context.modules" section. Do not replace it, respect the existing code. And a small correction to the code, adding " " to the below lines, following pipewire guidance:
==
node.name = "Moode AirPlay"
node.description = "Moode AirPlay"
==
Reply


Forum Jump: