TinyUSB Arduino

TinyUSB with a thin layer of Arduino library. Other implementations are subsets of TinyUSB. This library includes host and device, all classes including USB audio. This supersedes my host only library for Giga. The TinyUSB examples have been converted to sketches. Other boards can be used but the emphasis has been on Giga because it has two USB controllers. No soldering needed to use Giga USB host.

OpenCode coding agent and a variety of coding LLMs used to develop this library.

This project is not part of the TinyUSB project so DO NOT report problems with this project to the TinyUSB project.

This is an experimental/proof of concept project made public. There is no commitment to keep this up to date, sync with upstream, regression test, accept PRs, etc. For amusement purposes only.

Here is an example of what can be done using this library on Giga.

The Mozzi synth project has been ported to Giga so start with this. Add USB device audio output on the Giga's Type C USB device port. The Giga appears to be a USB microphone to the PC. Audacity can record Mozzi output. Digital all the way through.

Add USB host MIDI on the Giga's Type A USB host port. Connect a nanoKONTROL2 or any USB MIDI control surface. Map knobs, faders, and buttons to Mozzi inputs.

SAM3X/Due is not supported by TinyUSB but this project includes a port developed by AI coding. Due is not recommended because arduino-sam depends on a old version of gcc. But if you have a Due board gathering dust, this project might make it useful. DO NOT report SAM3X/Due problems to the TinyUSB project because this feature is exclusive to this project.

Demo Giga app using USB device and host ports in the same sketch

A Mozzi subtractive synth whose audio leaves the board over USB Audio Class 2
as a 48 kHz mono capture device, so it shows up on the host as an ordinary
microphone/line input that any DAW or arecord can capture. On Giga,
a USB MIDI controller can be plugged into the USB Type A host port.

Control mapping (nanoKONTROL2 in CC mode β€” hold Set Marker + Cycle while
plugging it in):

Control Maps to
Faders CC 0–7 cutoff, resonance, attack, decay, sustain, release, LFO rate, volume
Knobs CC 16–23 pitch, detune, osc mix, filter EG, LFO depth, drive, spare, vibrato
Solo 0–2 octave βˆ’1 / 0 / +1
Mute 0 LFO on/off (latch)
Play / Stop gate the envelope
Rec 0 retrigger

With no controller attached it uses built-in defaults and drones, so it makes
sound on its own.