tinypilot icon indicating copy to clipboard operation
tinypilot copied to clipboard

Audio gadget using g_audio

Open shudza opened this issue 2 years ago • 5 comments

Hello.

Is it possible to add g_audio functionality to the composite gadget? I've used RPI zero to create a functional audio gadget which successfuly emulates an input and an output on a Windows system. Using newest raspbian, with 6.1 kernel (rpi-update), it pretty much worked without any hassle and additional config.

Posting as a question because I'm unaware of how the composite gadget actually works and what are the limitations.

EDIT: should be configurable using this

shudza avatar Feb 28 '23 21:02 shudza

Thanks for reaching out!

We're interested in exploring the g_audio gadget for forwarding a microphone on the client machine to the audio input on the target machine. We've been able to create the device, but the hard part seems like it's going to be streaming the audio from the browser to the remote device.

If you'd like to explore this, we'd be happy to hear about your progress!

mtlynch avatar Mar 02 '23 16:03 mtlynch

The way I did it is pretty dumb and inefficient. I start a mumble server + client on the PI and map the PI's client to the USB audio device. I can then connect to the same mumble server with any other client and my voice is transmitted and vice-versa. The pros:

  • easily configurable
  • quality audio streaming with many options for latency/bandwidth/compression The cons:
  • bloated
  • raspbian's mumble version is outdated (1.3.4)
  • cpu intensive (mumble's noise reduction algos etc.)
  • mumble's cli is bugged and pretty much not working at least on (1.3.4)

There is a mumble web client , so this all could, in theory, be jammed into the tiny pilot.

One other project that does Audio over IP is vban, but lacks web client, low configuration, no codecs etc.

shudza avatar Mar 02 '23 20:03 shudza

Oh, cool. Thanks! This gives us some useful areas to explore.

Another user has also experimented with something similar using Jacktrip.

mtlynch avatar Mar 03 '23 07:03 mtlynch

Jack is definitely an option, although this approach doesn't use the usb gagdet actually and requires extra hardware (2x usb sound card). There is a few options for Jack over IP but I guess it will still be hard to get it inside a browser and not use a lot of bandwidth.

Btw, is building mumble from source a possibility in current tiny pilot stack? I think that is the deal breaker when it comes to mumble approach.

shudza avatar Mar 03 '23 09:03 shudza

It's possible, but it would be more likely that we'd distribute our own mumble Debian package so we're not compiling on every user's device. But mumble is pretty heavyweight for what we want, so we'd look for lighter solutions.

mtlynch avatar Mar 03 '23 09:03 mtlynch