LibreELEC/Kodi line-in audio playback

  • LE is running on my PC and I'd like to have Kodi play the audio from the PC soundcard's line input. For this I intend to use pulseaudio's module-rtp-sink. I got this idea from the source code of the librespot addon by awiouy. He uses pulseaudio to loop audio from librespot into Kodi for playback. I've seen here that he runs

    Code
    pactl load-module module-rtp-send source="$LS_SINK.monitor" destination_ip=127.0.0.1 port="$LS_PORT" source_ip=127.0.0.1 > /dev/null

    and then has Kodi play the stream generated by pulseaudio.

    I'd like to do something similar where I have module-rtp-sink send audio from my line input as 'source' and have Kodi play the generated RTP stream.

    So far I have managed to load the pulse module and have it read from the soundcard's input. What I did not figure out yet is how to have Kodi play the RTP stream from the loopback interface. Can someone point me in the right direction? Thanks!!

  • Hey awiouy! Thanks for your input!

    Yeah that's the point I don't quite understand :) I'm not really familiar with python...

    I had hoped that I could just write a STRM or M3U file that Kodi understands, with the RTP URL and maybe a hint on the file format in it. I tried going this route but Kodi complains that it cannot play the file. I guess it needs more information on the file format. I don't know how to provide that.

    On line 80 it looks like you define the item to be played. I understand the 'rtp://127.0.0.1:{port}' part, but how is .format(port=PORT defined?

    Is there a URL that I can pass to Kodi that basically says rtp://<loopback>:<port>.<format> or similar? If so, what would the format be? In your code I see a reference to mp3 but I thought pulseaudio would just stream PCM data via RTP?

    If it's not feasible to start playback via a URL, M3U or STRM file I'll have to learn some Python I guess.