Possible to have Analog and loopback audio?

Maybe I’m going about this the wrong way. My ultimate goal is to get OSMC to stream the currently playing mp3 to Icecast2. Is there maybe a way to accomplish this with a plugin? I have absolutely zero idea how to author plugins for Kodi. It would be absolutely ideal if it could broadcast the metadata, like edcast, as well as working independently of the audio source selection in Kodi.

Creating a plugin would be a significant step-up in complexity from what you’re currently trying to do.

BTW, I managed to get the .asoundrc to work successfully - and without the need for the named pipe. The site you linked to had just done a copy/paste from another site without understanding the ins and outs of the file. This one works with OSMC on a Pi3:

pcm.multi {
    type route;
    slave.pcm {
        type multi;
        slaves.a.pcm "output";
        slaves.b.pcm "loopin";
        slaves.a.channels 2;
        slaves.b.channels 2;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
    }

    ttable.0.0 1;
    ttable.1.1 1;
    ttable.0.2 1;
    ttable.1.3 1;
}

pcm.!default {
	type plug
	slave.pcm "multi"
} 

pcm.output {
	type hw
	card ALSA
}

pcm.loopin {
	type plug
	slave.pcm "plughw:Loopback,0,0"
}

pcm.loopout {
	type plug
	slave.pcm "plughw:Loopback,1,0"
}

You now play to the default analogue output (not loopback) and a copy is made available on loopout for you to use with ffmpeg.

1 Like

SO CLOSE! Maybe I am using the wrong command to start EZstream, but I am able to hear audio through the analog output and when I start streaming using this command:

avconv -f alsa -i loopout -f mp3 - 2>/dev/null | sudo /usr/bin/ezstream -qvc /etc/ezstream.xml

it does start streaming to Icecast. The player connects and appears to be streaming, but there is no audio.

I assume the ‘loopout’ is no longer valid?

Hey, welcome back! I thought you’d done a runner. :wink:

You’ll have to get to the bottom of the ezstream issue yourself, since that waaay outside the scope of this forum (and my own knowledge) but I can confirm that “loopout” is what you need to use with the avconf/ffmpeg command, assuming you’re using the .asoundrc from post #43. I guess that would make it “valid”.

Good luck. If you get it to work, please report back with details.

No, I had a bunch of work to catch up on and forgot to check back.
Thank you so much for all your help. I am really close to getting this going and it is 100% because of you. I really appreciate all your time and effort, as well as persistence.
Do you have a Paypal address so that I can tip you a six pack or something?

Thanks for the kind offer. My time is freely given.

But if you want to make a small donation to OSMC, you’ll find details on the Download page.

I will, for sure. So, just to be clear and help me going forward, I follow the tutorial from the link I listed, but the only change is that I substitute your .asoundrc instead of the one he listed? Everything else is the same?

From my perspective, yes, everything else is the same. That’s not a guarantee that everything else in the article is correctly described. Many blogs just seem to copy/paste from other sites, so incorrect information can become widely propagated.