Using multiple devices as a single speaker system is not a new idea, but a quick google search shows that there are currently no existing systems that do this seamlessly and perfectly. This is my attempt at a problem that looks easy on the face, but is twisted within.
What it does
AudioSync syncs up the audio playing on multiple devices connected to the same network, effectively allowing the devices to form a speaker system.
How I built it
AudioSync is built on NodeJS. A server was required to sync up the play times and one client acts as the media host. The media host has the ability to choose the media and control the playback. All other clients simply work as glorified speakers.
A NodeJS server is setup anywhere on the local network and the media host and other speakers connect to the server through a HTML 5 enabled browser. The media host presses play and the server gets to work syncing the output of the speakers.
Challenges I ran into
The biggest challenge I ran into was syncing up play times when the audio was streamed over the internet. Even slight changes in speed between different laptops ended up in out of sync sound. Even seeking the lagging speakers to the correct location didn't fix the problem, since they would start lagging immediately.
The only solution I could come up with was to preload the audio to all the speakers as soon as they connect to the server.
Accomplishments that I'm proud of
I am proud of my first attempt at a problem that does not seem to have an ideal solution. En route to the current solution, I realized that this system would be more maintainable if all the clients, including the media host was synced up to the server instead.
What I learned
Having dabbled in NodeJS and WebSockets, I had a rough idea of how sockets acted as 2 way pipelines. Until now, the use case scenario had been mostly theoretical. I was a great experience making relentless use of sockets to messenger data to and fro.
What's next for AudioSync
I plan to implement server side sync up rather than all speakers syncing up to the media host. This would also allow the server to stream media to all the clients and if one goes out of sync, pulling it back in sync would become easier and more seamless.