Toslink Delayer To Sync Audio

Andy Haus ran into an annoying issue with his Amazon Echo Link music streaming devices: despite being connected to their respective host speaker systems via TOSLINK optical cables, one was lagging behind the other, meaning music played over both was out of sync.

Since the ~200ms delay was being caused by internal processing in one of the systems itself, and Amazon provides no adjustment facility, Andy designed a custom PCB for the Teensy 4.0 and took matters into his own hands.

The solution takes in S/PDIF from the Echo Link using a DLT1150 optical fiber receiver, then delays it by an adjustable amount (up to 750ms), before outputting it again over TOSLINK to the speaker system via another DLT1150. The delay value is stored in EPROM in order to maintain the configuration in the event of power loss. An SSD1306 OLED display shows status, including CPU usage, which hovers around 30% when underclocked at 150MHz. Source and schematics can be found in the GitHub repo.