PDA

View Full Version : Problems syncing squeezeslave



OldeSchule
2007-09-11, 07:09
I've finally figured out how to run two instances of squeezeslave on the same Linux box (start the one pointing to dsp1 FIRST, then dsp0 - use -o 1 for the first one), but now I'm having pretty serious problems with the two instances getting out of sync.

By halfway through the first song it's noticeable... by the end of the song it's totally unacceptable. This is a big issue for me, since the ability to sync 2 players is one of the major things that brought me to SlimServer. (I'm setting up multi-room/multi-source audio in my house, and I'd like to have adjacent rooms sync'd.)

I tested this last night with the latest squeezeslave (0.7.2), and I'm running SlimServer 6.5.4. Both platforms are Ubuntu Linux. The box running the 2 squeezeslave instances is an 800Mhz P3 with 256MB memory - top shows it's at 91% idle CPU, so I don't think it's a horsepower issue.

Any suggested tweaks? I know I can do things on the client side with VLC, but I'd like to keep this within the SlimServer interface if possible. (I'm the only geek in my house... probably a good thing.)

Dominique
2007-09-12, 19:50
Hi,

If two instances of squeezeslave running on the same machine are progressively getting out of sync, it means the two output devices are not synchronized together at the hardware level, meaning they each have their own crystal that oscillate at a slightly different rate. There is nothing squeezeslave can do about it. If this is the problem, then you should notice that it's always the same output port that gets ahead of the other (assuming the two crystals are consistent in their bias)

You are sure you are not getting dropouts, are you?

Also: what is the relation between these two devices? Same card, different ports? Two different cards? Can you try with other output ports (assuming you have more than to stereo output pairs)?

May I also ask why you are running two instances of squeezeslave on the same machine? I guess you want to feed 2 different rooms with the same signal, but isn't there another way to route the signal to avoid running two instances of squeezeslave? For example, on my setup, I have two digital output ports: one optical and one coaxial. Because they use the same clock and the same audio source, they are guaranteed to be synchronized so I could feed two separate DACs and they'd be in sync (assuming you always want the same content in both rooms of course).

Advanced sound cards sometimes let you control synchronization sources so multiple output ports are synced together, but you'd have to say more about your setup, and you may have a hard time configuring this aspect of the card on Linux.

Hope this helps you understand/analyze the problem. I'm doing some maintenance in squeezeslave these days, so if you can help finding problems in there be welcome to report them here.

Also don't forget to look at version 0.7.3, announced in the "squeezeslave enhancements" thread, in the developers forum.

Dominique

OldeSchule
2007-09-13, 06:26
Thanks for the info - I had sort of figured that was the issue after digging through some PortAudio code last night. (Used to be a coder, now I'm more of a hosting/networking/security type. It's been a while since I've tried to read through "real" C code.)

I tried playing with PA_MIN_LATENCY_MSEC, even setting it different between the 2 instances. I'm pretty sure I'm not getting dropouts, although the 2 sets of speakers are still pretty close together while I'm setting this up. As you said, I'm trying to control 2 rooms from 1 machine, although I'm guessing that one instance apiece on 2 machines would have a similar issue. I would like to give the 2 rooms the ability to be synced, but not require them both to always be on. (My deck and patio are 2 other "rooms" I would like to have synced - I'd rather not have the patio on if we're just on the deck.)

I realize I'm trying to get champagne results on a beer (OK, maybe wine) budget - I'm just trying to figure out when I have to switch to cheap champagne, or just expect it to taste bad. :) I'm much more of a computer geek than an audiophile, but I still like my music to sound good. (Listening to flamenco guitar get out of sync is PAINFUL!)

One question - if I had 2 identical soundcards, should I expect them to still have this issue?

I'll also take a look at 0.7.3, although 0.7.2 took care of some of the issues I was having. It's still a little flaky every now and then - looking at lsof it doesn't always open the socket back to slimserver, but wrapping it with aoss (an earlier hack I tried) seems to alleviate that for some reason.

I'll try to keep my geeky questions out of General and put them over in the developers or Linux forum. Sorry, still a noob here.

awy
2007-09-13, 08:58
My experience is that sound card clocks can easily drift by as much as 1ms/s. This means you will hear the offset in less than 30s, especially if the two clocks are drifting in opposite directions or have worse drift.

The sync-maintenance code coming in SlimServer 7 should help you out here, but you will also have to wait for me to make the protocol changes to squeezeslave for it to work well. I would probably want to use hand-picked crystals if I was intending to use softsqueeze regularly for synced listening as I expect that 10ms adjustments every 10s could get pretty annoying - I do not notice the occasional adjustment but I suspect regular ones at that sort of rate would be noticeable.

Alan.

Dominique
2007-09-13, 09:08
One question - if I had 2 identical soundcards, should I expect them to still have this issue?

Yes you will get the issue. No matter how good the cards are, if the output ports are on separate hardware and share no sync source, there will always be a chance of getting out of sync. As shocking as it seems, a PC has no clock source that gets used by all audio/video devices for media synchronization (SGIs have this for example, but this is just an expensive digression).

As far as I know, there are two options (others correct me if I'm wrong):

1. One card with multiple outputs (less expensive)
2. Multiple cards which share a synchronization signal like word-clock or sync-from-digital-in, assuming there is a digital source to feed the cards (more of a studio/professionnal setup).

I'm in a rush now so I have no time to go fishing for good hardware suggestions, but I'm sure you get the point: do your shopping right.

I'll disappear until beginning of October, so good luck!

Dominique

OldeSchule
2007-09-16, 19:08
Yes you will get the issue. No matter how good the cards are, if the output ports are on separate hardware and share no sync source, there will always be a chance of getting out of sync. As shocking as it seems, a PC has no clock source that gets used by all audio/video devices for media synchronization (SGIs have this for example, but this is just an expensive digression).

As far as I know, there are two options (others correct me if I'm wrong):

1. One card with multiple outputs (less expensive)
2. Multiple cards which share a synchronization signal like word-clock or sync-from-digital-in, assuming there is a digital source to feed the cards (more of a studio/professionnal setup).

I'm in a rush now so I have no time to go fishing for good hardware suggestions, but I'm sure you get the point: do your shopping right.

I'll disappear until beginning of October, so good luck!

Dominique


THANKS! This pointed me toward exactly what I needed. My soundcard (CM8738) provides surround-sound; it also has 2 separately-addressable DAC's, so I can have 2 separate 2-channel outputs. I now have 2 instances of squeezeslave, perfectly synced (or not, depending on who's listening where).

Hope you re-appear well-rested!
Terry

Dominique
2007-10-02, 20:14
The sync-maintenance code coming in SlimServer 7 should help you out here, but you will also have to wait for me to make the protocol changes to squeezeslave for it to work well. I would probably want to use hand-picked crystals if I was intending to use softsqueeze regularly [...]

I had stayed away from outlining solutions affecting content (skip or resample) on purpose in my reply since in the described scenario both instances are running on the same machine and thus, in an ideal world, should use the *same* crystal (and not 2 hand-picked ones, which will always drift).

But for situations where sharing the sync signal is not possible (e.g.: 1 squeezebox and 1 squeezeslave), then this resync feature you are describing will be a great improvement, thanks for the heads up!

Dominique

TheNabil
2007-11-15, 03:35
Terry,
You said :

"I can have 2 separate 2-channel outputs"

I have a terratec Phase 88 card that has 4 analog stereo outputs.

I can't figure out how to configure squeezeslave or softsqueeze
to use sepcific output channels.

Can you please explain how did you do ?

Thanks :)

PS. : I'm using windows XP, so I'm still using squeezeslave 0.7.0

Dominique
2007-11-17, 10:20
I can't figure out how to configure squeezeslave or softsqueeze
to use sepcific output channels.


Hi,

I can answer the part about squeezeslave (sorry, I don't use softsqueeze).

When you start squeezeslave at the command prompt, it enumerates all the devices it sees and show their associated "id". By default, it will pick the first one, but you are free to override this choice by using the -o option.

If you don't see all the devices you are expecting, then you should look in the card's driver settings; I have no first hand experience with this card, but I once had a multi-channel soundcard that gave the user an option to present the various pairs as separate devices. If your card has such a feature, turn it on.

Hope this helps,

Dominique

OldeSchule
2007-11-21, 20:25
Sorry, I've been away from the forums for a while. (Things were working!) I'm back to get squeezeslave working with my new 7.0 server. :-)

As Dominique said, squeezeslave will take command-line arguments to point to different devices. There have been other posts regarding how to do this with Softsqueeze as well - it requires some additional command line parameters to java.exe when it starts. A quick search with something like "softsqueeze multiple channel" should do the trick.

On my soundcard, I had the option of surround-sound or 2 separate 2-channel devices. The specifics of how to change the setting will vary widely from OS to OS and card to card - in my case, I'm on Linux and did it with alsamixer. (Getting squeezeslave to work with alsa, 2 sound cards and 3 devices was quite an interesting exercise...)

Hopefully you've already figured that all out by now...