USB audio - best practice and two questions

Davidelvig

Well-known member
I've been sending audio MIDI and serial out through USB with this define in PlatformIO

build_flags = -D HW_T41 -D USB_MIDI_AUDIO_SERIAL

The use of USB audio is new for me.

I'm testing with GarageBand, and an audio track and connecting it to "DigiBrass MIDI" audio in port (see question 1).
It works very well, until periodically disconnecting with this message
1730308563467.png

(question 2)

so:
1) How to get a different named DigiBrass Audio
I'm using a name.c file in my project like this
#include "usb_names.h"
// Edit these lines to create your own name. The length must
// match the number of characters in your custom name.
#define MIDI_NAME {'D','i','g','i','B','r','a','s','s',' ','M','I','D','I'}
#define MIDI_NAME_LEN 14
// Do not change this part. This exact format is required by USB.
struct usb_string_descriptor_struct usb_string_product_name = {
2 + MIDI_NAME_LEN * 2,
3,
MIDI_NAME
};
GarageBand shows this
1730309202706.png

Is there an analogy for USB audio naming (perhaps an example like the MIDI_name example)?

2) What might be causing the USB audio to lose connection with GarageBand. Of note, the connection sometimes returns with a new identical dialog box.

I'm routing my audio to USB using the Audio Library like this.
1730308954984.png


This also happens without GarageBand, and with LoopBack installed.. those LoopBack only fails briefly then reconnects automatically.
Is there anything in the sound itself (e.g. really loud signals) that might do this?

3) What the best practices for USB audio out? ... with Teensy 4.1, SGTL5000 (on my own board, driven by Teensy)

Thanks
 
Last edited:
I have an update... I thought my testing of LoopBack was without GarageBand in the background. I was in error.
Now I can run EITHER GarageBand or LoopBack with fails (so far) but either will fail periodically if the other is running. Even if they are not apparently using the port (no track in GarageBand, LoopBack's connection button "off") they still seem to conflict.

That leaves questions 1 & 3, please!
 
Pinging to restate and update:
The immediately-previous post had a critical typo: "Now I can run EITHER GarageBand or LoopBack withOUT fails"

That leaves the two of the previous questions, the latter one being more specific:

1) Is there a different name parameter for USB MIDI and USB AUDIO. For now, I've genericized the name to "DigiBrass" as opposed to "DigiBrass MIDI"

2) Solved!

3) Selective use of USB Audio - More detail

  • I compile for Serial + MIDI + Audio - all work well
  • Can I adjust the settings to only publish AUDIO OUT instead of IN and OUT
  • Can I disable Audio Out which the sketch is running? - see below:
Some apps are aggressive about grabbing the newly-plugged-in device, thinking it is the desired audio mic or speaker, I guess.
Zoom is one such app, and annoyingly, the iPad version of Zoom does not allow setting it back to "iPad microphone"
  • So, with Serial + MIDI + Audio is defined at start-up, can I "undefined" or disable USB Audio during runtime based on some user configuration of my app?
  • Can I enable USB Audio after start-up - with a command as opposed to a #define?
Thanks!
 
Back
Top