FLOSS contribution: Nannou x Helios Laser DAC integration

Framework Overview

Nannou is an open-source framework aimed at making it easy for artists to express themselves with simple, fast, reliable, portable code. Whether working on a 12-month laser installation or a 5 minute sketch, this framework aims to give artists easy access to the tools they need.

Contribution

Since the library only had support for the Etherdream DAC and because I had newly become an owner of a Helios DAC, I decided that it would be a good learning experience to integrate support for it in order to deepen my knowledge of the Rust programming language.

Max Jöhnk had already written a Rust native version of the original C++ API. This was a good starting point for the integration. From this I created a fork that added; the retrieval of the DAC ID when claiming the USB interface, a close function to drop the interface after use and a DAC parameter struct to lineup with the Nannou::Laser crate.

There were two major challenges with regards to this integration; DAC detection and laser data stream handling.

DAC Detection
For DAC detection, there are two major differences between the Etherdream and Helios DACs:
  • Etherdreams are network connected through TCP/UDP. They allow for detection while simultaneously producing output.
  • Helios' are connected via USB. Detection and output can not be done simultaneously as this is not supported by the hardware (blocking USB interface).
This allows Nannou to simultaneously detect Etherdream DACs on one thread while sending frame/point data on another. With Helios DACs, either detection or data sending can be done, but they can not be done at the same time. Differences in DAC detection can be found in dac_manager.rs.

Laser Data Stream Handling
There are two major differences between these two DACs in terms of data stream handling which are:
  • Helios DACs must be polled to check if they are 'Ready' before a new frame can be sent. A 'NotReady' state means that the frame buffer in the DAC MCU is being read to produce output and is not ready to accept anymore data. The Etherdream's buffer on the other hand can be checked for it's 'fullness', returning the amount of free points in the buffer that can be sent.
  • The Helios API only allows for sending frames, whereas the Etherdream allows for sending individual points. Although not ideal, this is circumvented for the Helios DAC by creating a frame containing only one point.
These differences allow the Etherdream to produce more fine grain output making it more suitable for real-time applications such as mapping to raw audio streams. The differences between these DACs for data stream handling can be seen here in raw.rs.

Technologies/Libraries used:

Description

Adding Helios DAC support to the Nannou::Laser crate.