Hi,
is there a way to run multiple snapcast clients on the same device ? Im using an OrangePi with multiple USB sound cards attached. I can also start instances on the specific sound cards, but they can't be controlled via the android app, since all clients from the same device seems to have the same name.
Thanks, Jo
The only way I can think of is getting an additional hostname and possibly an additional network interface (think virtualization).
You could try: https://github.com/marineam/chname
If this doesn't work have a look at linux containers (LXC).
Although I think it is rather inefficient to send multiple streams to one client.
Thanks a lot, your suggestions point me to the right way. With chname i could set the initial name of the snapclient. But i also have to change the mac address of the device. I haven't looked at the source code but i think the mac - address is used a primary key to indentify the client. The follwoing works for me (really bad hack but working :) )
# Start first instance
ifdown eth1
ip link set eth1 address 02:00:00:00:00:01
./chname Server1 ../snapcast/client/snapclient -s13 &
ifup eth1
sleep 2
# Start second instance
ifdown eth1
ip link set eth1 address 02:00:00:00:00:02
./chname Server2 ../snapcast/client/snapclient -s27 &
ifup eth1
multi-instance would actually make sense.
I will put it on the roadmap. What's missing is actually an instance id.
Great, thanks a lot :)
Unless I'm missing something, nothing prevents you from running multiple instances of snapclient on the same host. I actually did it by mistake yesterday, as I was testing around. This led to an interesting effect: both clients play in near-perfect sync, but _near-perfect_ and not _absolutely in sync_ ends up creating a flanger type effect to the music. This happens both with the two clients's sound coming out of the same speakers or with the two clients's sound coming out of different soundcards (ie jack and exeternal DAC on a raspberry pi, for instance).
For this reason (weird flanger effect), I think snapclient should at the very least warn you, and possibly refuse to start, if you try start it with another snapclient already running. And then you can use an option to confirm you really want to run another instance maybe.
yes, you can start multiple instances, but they identify theirselves by their MAC towards the server. So the server will "see" both and send them the audio stream, but the server cannot differentiate them and you cannot assign different streams or volume levels in a controlled way.
So something like MAC address plus client ID is needed to make each instance unique. And yes, the start for an already running client ID should be refused
Hi, maybe an additional parameter to overwrite the instance MAC towards the server?
I started working on it again.
But yes, it's the basic idea: combine MAC and instance ID to a unique id.
or maybe a cli parameter to set the "mac"-id
on Linux I used macvlan to create virtual network interfaces and then I use linux namespaces to have several snapclients run on dedicated interfaces having their own MAC and IP.
The multiinstance part is already done in develop branch (except of some details, like the pid file - so call it work in progress).
I make heavy use of it during the implementation of the grouping feature (bundle clients and a stream into a group).
A beta release will be out during this month.
@unimatrix27 this macvlan thing sounds interesting also for development and testing purposes. Can you explain how this setup is done?
I manage to setup macvlan links, but how to assign different vlan interfaces to different clients?
Sure,
assuming you have already setup a number of virtual interfaces with macvlan, lets call them veth0, veth1, veth2 - you need to move them into seperated namespaces and then run the different snapclient instances inside of those namespaces. Once moved into a namespace, you need to assign new IPs via DHCP or static. Example:
ip netns add snap1ns
ip link set veth0 netns snap1ns
ip netns exec snap1ns ip link set veth0 up
ip netns exec snap1ns dhclient veth0
whatever you exec now via ip netns exec only sees veth0 and no other network interfaces. Just do a ip netns exec ifconfig to check this
Then run snapcast inside the namespace:
ip netns exec snap1ns snapclient -h x.x.x.x -s <audiodevice zone 1> -d
If you also want a seprate hostname for the isolated instance, run
unshare -u
sudo echo newhost > /proc/sys/kernel/hostname
and then start the snapclient.
TBH i dont need anything else and could live with just the MAC as ID of the clients. Maybe others disagree. I would have a list of other feature "wishes" haha...
@unimatrix27 thanks!
I was playing around with docker and a macvlan network driver so far. The solutions with namespaces feels more lightweight.
Anyways: If you like it or not, the ID feature is already there :wink: (makes sense to have (1.) a real clientId (which is actually the MAC for client ID 1), and (2.) there are other OSes (Windows, embedded, ...) which might not offer such tricks)
That's interesting, I wasn't able to start snapcast in a docker
container back when I tried. This solution does look elegant, but I'd
still be interested in understanding how you've been using docker. Maybe
this would be more at home on the project's wiki documentation though.
On 13/12/16 09:16, Johannes Pohl wrote:
>
@unimatrix27 https://github.com/unimatrix27 thanks!
I was playing around with docker and a macvlan network driver so far.
The solutions with namespaces feels more lightweight.
Anyways: If you like it or not, the ID feature is already there 😉
(makes sense to have (1.) a real clientId (which is actually the MAC
for client ID 1), and (2.) there are other OSes (Windows, embedded,
...) which might not offer such tricks)—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/badaix/snapcast/issues/73#issuecomment-266674361,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABHjIA4mkqEaDbwKxV8lfuy_HWMRKT-oks5rHlR0gaJpZM4IuYW8.
fixed in 0.11.0
use -i or --instance
Forgive my ignorance, but how would I setup multiple snapclients on a raspi?
snapclient -s 13 and snapclient -s 26 work for me for example, what would I have to write into /etc/default/snapclient ?
Most helpful comment
Forgive my ignorance, but how would I setup multiple snapclients on a raspi?
snapclient -s 13andsnapclient -s 26work for me for example, what would I have to write into /etc/default/snapclient ?