News for hackers. Stuff that matters.
Re:Raspberry Pi 4 can finally boot directly from USB by joshspankit on Friday September 18, 2020 @06:42PM (#24522562)
The different clocks is a real hurdle.

I have to give credit to Apple on this one, as they had the genius idea to make the buffer >1s, and send control messages independent of the audio stream.

There’s gotta be a way to do it with PTP and the same ideas but clearly it’s either an extremely difficult problem, too niche, or both.

Re:Raspberry Pi 4 can finally boot directly from USB by loxias on Saturday September 19, 2020 @01:18PM (#24528963)
Correct. You use PTP+NTP, the RT_PREEMPT patches, and then you have to deal with a constantly varying resampling ratio (!!) And not only that, but if you don't want nasty artifacts, the a LOT of thought also has to go into your filter design. It's hazy, but I remember using a pair of orthonormal time-varying allpass IIR QMF filters, with extra black magic I'm blanking on that allowed me to reduce the complexity of finding the coefficients for, and computing the filters by at least a factor of 4. Fun stuff. I think half the coefficients in the EQMF were zero, and of the other half, half were the reciprocal of another, which led to a fast implementation.

But yeah! I've done that. Kept audio streams to within a few samples of alignment for more than 24 hours. It was fun, and yes, somewhat hard. "will more than happily do it again for money". :)

Re:Raspberry Pi 4 can finally boot directly from USB by tinus_hn on Saturday September 19, 2020 @02:22PM (#24529440)
Why would you send samples? If you do any kind of compression you’re going to convert to frequencies anyway and it isn’t that much of a hassle to expand that.
Re:Raspberry Pi 4 can finally boot directly from USB by m463 on Saturday September 19, 2020 @04:48PM (#24530222)
That sounds like a better solution - I'd guess most a/v systems are used for pre-recorded video that could deal with more delay during stop/start/pause but giving you more synchronization.

To really do it right though I think it would be cool to tune everything somehow. So have a microphone + photodiode sensor you put in your chair, then run a test and have it synchronize all audio and video sources together. (maybe it could even be pointed to your bluetooth headset and do that delay too)

I think with that setup, you could not only get good synchronization, you could probably tune the delay to the minimal value (maybe you could still do stuff like something live)

Re:Raspberry Pi 4 can finally boot directly from USB by MisterAV on Friday September 18, 2020 @08:23PM (#24523358)
What is the requirement for synched audio? milliseconds, microseconds, nanoseconds,...

I'm currently working on devices that synchronises themselves wirelessly indoor over a large area and I'm now wondering if music could be an application I haven't though about...

Re:Raspberry Pi 4 can finally boot directly from USB by londons_explore on Friday September 18, 2020 @09:55PM (#24524164)
10 ms is fine. 100ms works but you get odd echoes like a speaker system in a big building.

You need some way to compensate for clock drift between different playback devices. Even good clocks will drift 10ms in a few hours.

Re:Raspberry Pi 4 can finally boot directly from USB by loxias on Saturday September 19, 2020 @01:18PM (#24528972)
1ms is barely "ok". with 1ms you'll still hear ugly comb filter effects. (see my other comments)
Re:Raspberry Pi 4 can finally boot directly from USB by joshspankit on Friday September 18, 2020 @09:57PM (#24524177)
At most 10ms. Sub 1ms would be awesome.

And yes, definitely. If you can build in a “chromecast receiver” so that a user could cast to multiple synced speakers (at full quality), you’d definitely have my attention

Re:Raspberry Pi 4 can finally boot directly from USB by Dylan16807 on Saturday September 19, 2020 @03:23AM (#24525813)
It's worth noting that for two speakers playing the same audio, a 5ms offset will move the point of perfect sync by less than a meter. Going below a millisecond is definitely overkill territory.
Re:Raspberry Pi 4 can finally boot directly from USB by magnetised on Saturday September 19, 2020 @08:57AM (#24527118)
In 1ms sound travels just over 30cms - so just moving around a reasonable room affects the offsets between two well spaced speakers by 5-10ms. I use my own multi room audio system at home - http://strobe.audio - and although the sync isn’t perfect by any means the effect of moving around your house usually the problem. Eg if you have the volume in another room loud enough that it’s louder than the music from the room you’re in you get the weird echo effect. Otherwise nothing.

Turns out our brains are really good at compensating for relatively large offsets

Re:Raspberry Pi 4 can finally boot directly from USB by loxias on Saturday September 19, 2020 @12:34PM (#24528616)
I beg to differ: a good rule of thumb is that an (audio) sample takes about 8mm (44.1k). By the time you're a full 1ms late, that's a 44 sample difference between the two (or that's as though the speakers were about a third a meter apart.

And that distance, you're gonna hear some uncomfortable comb filtering. A third of a meter corresponds to a frequency of about 1khz, which is right smack dab in the middle of a critical band, so you WILL hear the constructive and destructive interference around ~1khz.

(and _5ms_? That means the speakers are now ~220 samples out of sync, so I'd expect any lows around 200hz to have some destructive interference, making the music sound hollow.)

1ms of sync is FAR less than adequate. It took effort, but I was able to get a distributed set of raspis to within about 5 samples at 44.1k, and I think I can do better.

Why do I know this or care? :) I've done (and still do) a lot of research (and inventions) in the field of microphone array processing and audio source localization -- tracking objects purely by their sound. With cheap commodity equipment I can generally get a resolution of 5cm, and with lots of fine tuning I was able to do sub-cm tracking.

Re:Raspberry Pi 4 can finally boot directly from USB by Dylan16807 on Saturday September 19, 2020 @02:48PM (#24529614)
All those problems happen even if your speakers are perfectly in sync. These aren't headphones. If you have a couch for listening, the difference between sitting on the left and sitting on the right is just as big or bigger. You get the same interference, yet it isn't a problem.
Re:Raspberry Pi 4 can finally boot directly from USB by m463 on Saturday September 19, 2020 @04:53PM (#24530252)
I think his thinking is still valid.

If you sit on the left or right the sound should still come from "center stage" or (x,y,z)=(0,0,0) without being shifted or drift.

Re:Raspberry Pi 4 can finally boot directly from USB by Dylan16807 on Saturday September 19, 2020 @05:40PM (#24530490)
Depends on whether you have a stage. If you're playing audio to go with a TV you don't want it drifting much. But when the scenario is playing music over an area you end up with a bunch of mutually-contradictory centers and it doesn't matter if they shift over a little. And music over an area is what sparked this talk.