Current state of USB audio

I noticed quite a few commits lately related to USB audio, and I was wondering what the current state is with its functionality.

I tried hrev45975 last night on my Thinkpad E420, but my USB DAC/amp wasn’t functional. It shows up with listusb, but there’s nothing in media preferences other than HDA audio, which doesn’t work on this laptop. Is there anything in particular I need to do to get USB audio working?

Cheers, and thanks to all the developers for the ongoing hard work.

Safe and functional support for isochronous transfers is only available for USB1.1 OHCI controllers at the moment. USB1.1. UHCI and USB 2.0 EHCI implementations need to be fixed or refactored for using it. USB audio driver is not in the image because trying it with UHCI or EHCI controllers can be dangerous for the system. But it can be activated for user builds in UserBuildConfig.
If you USB audio hardware conforms to standard USB Audio specifications 1 or 2 it should be supported by this driver. In case it uses vendor-specific protocol - additional driver is needed.
More information about USB hardware can be acquired using listusb command with ‘-v’ option with the device entry as argument. Could you share this info with me? Thank you.

Probably you need a proper driver for your sound card.

http://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/drivers/audio

Create ticket - https://dev.haiku-os.org/

Ah, so is the USB audio driver not in the current nightly builds by default? If not, where do I get it? Also, it was my understanding that USB audio was fairly well standardized. Is that not the case? Is separate driver support needed for each device?

The built-in HDA (Conexant based) in the laptop doesn’t work. It shows up in media preferences, and it appears to be playing files in MediaPlayer, but no sound comes out.I’ve read reports of similar problems with HDA variants, particularly with Lenovo it seems. The lack of HDA wouldn’t bother me at all if my DAC/amp worked.

Cheers, and thanks for the help.

Support has been added for USB isochronous streams. This allows you to work with USB sound cards. But existing driver for the sound card chipset is also important. At least as I understand it…

https://dev.haiku-os.org/ticket/1045#comment:12

Ah, I see. I made the assumption that all USB audio devices were standardized. It seems that way on Windows/Linux/OS X, but obviously it’s more complicated than I thought.

Thanks for your help.

Cheers

So… cheap “driverless” models probably would work but something like a creative soundblaster whatever with 5.1 surround etc…probably wouldn’t work but if if did it would be only to the extent that the basic usb driver supported.

Webcams are pretty ubiquitous these days support for those will be nice too if we get WebRTC in one of the browsers.

Thanks for clearing that up Siarzhuk! I too am keen to see USB audio support make it into the nightly images but it sounds like either the kernels USB stack and/or the driver need some more work yet.

Any USB audio device that works under Linux (or iOS, to a lesser but maybe more significant extent) should also be capable of running under Haiku, eventually.

Both HDA and USB audio are using a generic driver model. There is some structural similarities between the two in fact: In both cases the hardware/firmware provides an API by which the driver can explore the hardware and retrieve something like a wiring diagram. Basically, it’s a list of nodes (amplifiers, mixers, selector switches, input/output sockets, etc.) including their in/out-pins and what pin on what other node they are connected to.
Special/advanced hardware will include non-standard nodes, like filters, DTS decoders. Only the manufacturer’s driver knows how to handle them. Generic drivers can safely ignore them since manufacturers make sure those nodes are either bypassed or put in a neutral state on initialization.
The main difficulty for the generic driver is to actually set up correct signal paths by putting selector switches into correct positions, setting the gain of all amplifiers within the path to proper values and switching off mute controls. It also needs to decide which parameters of which nodes to include as parameters for what the user will see in the device’s media preference panel. Haiku requires that at least a volume control be present for output and an amplifier gain for inputs. The kernel log messages of the HDA driver give some impression of that process.
With laptops, the problem is mostly that

  • they put extra nodes into the signal path for muting and
  • the correct selection between headphone / speaker / line-out is more complex.

My suggestion is to have the option to have all node controls accessible in the media preferences so that the user can set up the circuit until it’s working (and hopefully save that setup).
BTW, the BParameterWeb, i.e. the software infrastructure that Haiku provides to drivers for communicating parameter settings is still way ahead of what other OSs have.

Cool! I am very much excited to see that this is progressing. Maybe soon I will be able to use my Mbox 3 Mini in Haiku and perhaps start working on a professional DAW :slight_smile:

Has there been any progress made on getting some working USB audio support into the nightlies recently?

I’m not sure, but I don’t think there were major break-throughs lately. Maybe Siarzhuk makes an appearance and briefs us on the current status. For questions like this you may want to search for “usb” at the commit log. Even if one doesn’t completely understand the commit message (let alone the code…), it shows what folks been up to in general.

Regards,
Humdinger

so, a couple of years have passed, i can’t find any more info than is on this thread. Is there any support for any sort of external USB audio card in Haiku?

Generic usb audio devices that don’t require a specific driver on osx , windows or linux now proliferate, it would be great to get support for that working.

1 Like

Unfortunately the situation is still the same: only OHCI USB controllers can be used with our USB audio drivers. EHCI and UHCI (which are a lot more common on modern hardware) don’t support isochronous transfers yet, and these are required for usb audio (and most webcams).

Anyone with knowledge about USB is welcome to try implementing this.

Sorry to drag up such an old thread, but I was wondering if the recent improvements to USB in general will have any bearing on the future of USB audio on Haiku.

Thanks.

I have a patch offline that adds experimental isochronous support to the XHCI bus driver, but when I tried it with the usb_audio driver, it didn’t seem to work (and the driver started returning invalid buffer IDs to userland.) But the usb_audio driver never worked really well; so I should try to find a better testcase and then get that code committed.

I don’t really have time to learn the USB audio spec, so someone else will have to take up that mantle once I get XHCI isochronous support working correctly.

Any progress on this yet?

The XHCI isochronous support is merged and appears to be working. I patched the USB audio driver to the point where it does play audio … to 1 channel (and nothing to the second), and then drops/glitches every 2 seconds or so.

Like I said before, I don’t really have time to take on yet another driver. I still haven’t tracked down the USB3 boot failures, or the NVMe KDLs, or … etc. But I’d be happy to help someone else get started on this stuff.

6 Likes

Even if i’m not a dev but just a user, I believe that Haiku needs to involve more 3rd parties to “evolve” its audio funcs.

My suggestion is - as always, of course - to (officially) keep in touch with cross-platform audio libraries devs such as:

  • Cinnamon - Lightweight, High-level, Cross-Platform Audio API

  • libsoundio - C library for cross-platform real-time audio input and output

  • Superpowered C++ Audio Library and SDK - C++ Audio Library featuring low-power, real-time latency and cross-platform audio players, audio decoders, Fx, audio I/O, streaming, music analysis and spatialization.

  • NFDriver - A cross platform C++ audio driver with low latency.

  • audio - Cross platform audio playback library

  • AcousticsLib - Simple Cross Platform Audio Library

  • cubeb - Cross platform audio library

  • vaudio - An experimental cross platform audio library.

  • etc…

None of this have an Haiku “port”, so it could be interesting anyway to stimulate it.

Hope that heps, or at least inspires.