How to do USB audio
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... 52
Dave Higton (1515) 3526 posts |
Wow, you’re quick… I’ll try it this evening. |
jim lesurf (2082) 1438 posts |
Dunno at present. I’ll see if I can find out and report back. Jim |
jim lesurf (2082) 1438 posts |
This may be the place to look for audio class definitions. http://www.usb.org/developers/devclass_docs I’ll have a further look when I get a chance. Jim |
Dave Higton (1515) 3526 posts |
With the audio device plugged in via a hub, I couldn’t get anything at all. But anyway I’m well on my way with a noddy GUI USB audio player app, which will give me the chance to send plenty of control commands in a realistic way while replay is going on. (The player app is probably a dead end as a product. It serves me well as a learning experience and as a test bed for code that will be implemented properly elsewhere later.) |
Dave Higton (1515) 3526 posts |
Jim: I’m aware of versions 1 and 2 of the USB Audio Class documents, but I thought you specifically said that they weren’t what you mean? |
Colin (478) 2433 posts |
I think he mean’t audio class 1 and 2 weren’t USB1 and USB2 – though like you I thought he was refering to some specification not controlled by usb.org.
Hmmm… may be bad news for Jim as USB1 is only possible via a hub on the beagleboard. My understanding is that a USB2 hub ranslates the packets to USB2 so it can mix USB2 and 1 devices. It may be that when you plug in to the hub the devices get handled by EHCI can you check that when you get home. |
Dave Higton (1515) 3526 posts |
Certainly. |
jim lesurf (2082) 1438 posts |
Yes. AIUI Audio Class 2 ‘requires’ USB2, but isn’t the same thing. AIUI Class 1 is the audio protocol details and should work via USB1 and 2. Windows boxs have had to download a ‘driver’ to run Audio Class 2. However this seems to be a matter of the device being Audio Class 2. Even when their hardware drives Audio Class 1 via USB2 ports. Certainly, all the ports I have on linux boxes are USB2 – or USB3 – but all work with the ‘Audio Class 1’ setting of all the USB DACs I’ve tried. There are also detailed differences in the contents of Audio10.pdf and Audio20.pdf from the site I referenced. But I don’t understand them, so have no idea what that means! And I’ve assumed these are defined via the usual bodies like USB org since they are meant to be platform independent. Apple and Linux promptly adopted them with no problems. I’ll ask someone else about this as I ought to know anyway. May take a day or two before I get a reply. Cheers, Jim |
Colin (478) 2433 posts |
I’ve been and bought a couple of hubs a cheap one from poundland (1.00ukp) and a dear one (2.50ukp) from poundstretcher the cheap one is USB1 and works. The dear one, USB2, doesn’t. it fails with
If I plug the USB2 hub into the USB1 hub or rmkill EHCIDriver the audio device works connected to the usb2 hub – because without EHCI it attaches to OHCI and obviously is only working at full speed. At least I can now test the EHCIDriver. |
Dave Higton (1515) 3526 posts |
I’ve tried the latest USB modules on the analyser with my test file, using my “7.1” headset interface and the speakers. Both rendered the test file correctly – no repeats, no missing samples. The only detail I can find technically wrong is that there are 11 USB frames with 176 bytes before the first with 180; therefter it’s always 9 then 1. I cannot imagine it having any adverse effect ever, though. The audio sounds as clear as it should. I have a USB2 hub (a D-Link DUB-H7) plugged into the Iyonix. When I plug the audio devices into the hub, the app is unable to open a pipe, whereas it’s fine with the device plugged directly into the Iyonix. |
Dave Higton (1515) 3526 posts |
I tried running the new modules on my BeagleBoard. Executed from RamDisc so as not to be affected by loss of USB. Stiffed the machine completely. |
Dave Higton (1515) 3526 posts |
Using a USB1.1 hub with the Iyonix, I can use audio devices through it. I’m very glad I kept that hub. It’s been hugely useful. |
Colin (478) 2433 posts |
If you look at the taskobey file that loads the module you’ll see a line commented out
uncomment that and comment out the loading of the new usbdriver and try again. That’ll show if the new driver is the problem. Note it will require RO5.20 |
Dave Higton (1515) 3526 posts |
Ah. The BB only has 5.19 of February. Since I need to rebuild a new !Boot, that will have to wait for another evening. |
jim lesurf (2082) 1438 posts |
I’ve been asking one or two people I know in the ‘audio biz’ about the differences. So far I’ve had the following from some engineers at one company who’ve produced some USB DACs that cover both classes. “USB is one of those things where you have to sift thru all the documents. Docs for both USB audio 1 and 2 are available, describing USB audio in painful detail. A separate document detailing the differences would be a total nightmare! Essentially they work from the same principle, but descriptor changes are numerous. I can only point them to usb.org, with my deepest sympathy!” But I’ll see if some other poor soul has collated the differences. Jim |
Dave Higton (1515) 3526 posts |
Don’t worry about it, Jim. If it’s only the differences between USB Audio Class, versions 1 and 2, I have both documents, and I can understand and use them well enough. I had (mis)understood that there were two audio classes in some way, which is clearly not the same thing. All the audio devices I have are version 1. The question is whether there is any device on the market that is designed to version 2, and is cheap enough that I would be prepared to buy one. (And, despite all my history in audio engineering, I don’t bother with it these days, so it would have to be cheap.) If I don’t have access to a version 2 device, I can’t test what I write, so I can only reasonably write to version 1. I would need access on a long enough term that a loan would be out of the question. |
jim lesurf (2082) 1438 posts |
I’m far from sure. But I’m coming to the conclusion that the Classes simply refer to all the detailed differences for audio in the formal USB1 and 2. However AIUI a ‘USB2’ port/input can nearly always use the USB1 protocols for backward compatability. I’d expect most devices to be ‘Class 1’ (i.e. use the older details) as you don’t need ‘Class 2’ if you limit to a max of 96k/24bit. Which is probably fine for all but the most fanatic audiophiles. All the DACs I’ve tried/use that can do ‘Class 2’ provide this as an option the user can select. They came by default set to behaving as ‘Class 1’. As I’ve said, I’ve not bothered with ‘Class 2’ despite having DACs that can accept it. And I’m probably madder than most people when it comes to audio! 8-] So in summary, a working ‘Class 1’ that drives up to 96k/24 using the DACs I can check would be wonderful so far as I’m concerned, and I suspect for over 99% of all users. TBH if we got that and you/Colin then wanted to attempt ‘Class 2’as well, I might be able to help with a suitable DAC. But we can shelve this for another day. Jim |
Colin (478) 2433 posts |
Jim. It’s likely that your class 2 DACs are the only ones that have a chance of working on a beagle board – at the moment anyway. For full-speed (USB1) isochronous devices to work with EHCI EHCIDriver has to support full-speed isochronous devices explicitly and it doesn’t. It does support USB2 isochronous so Audio class 2 devices which are USB2 high-speed could work. Note |
Dave Higton (1515) 3526 posts |
Some good news. I’ve got the beginnings of a multi-tasking audio player working. It has a volume control, and I’ve whizzed the control up and down many times, therefore doing thousands of volume settings, each of which is two control requests. So I hereby withdraw any suggestion of a problem of control and isochronous pipes clashing. I need to do a bit more work, then I can make it available to anyone who wishes to experiment with it. Note: it has to be given some information about the audio device it’s being used with, and this is USB technical information, including the alternate number, the endpoint number, and the number of the feature unit that controls the volume. I haven’t even started work on finding that information automatically. So it’s for techies only, initially. That having been said, if you use it with one of those cheap eBay “7.1 Channel Sound” USB audio interfaces, I’ve found the numbers for you. |
Colin (478) 2433 posts |
Dave. I’ve been thinking about how to avoid needing to supply information. We have each device with its own set of controls. So if you intercepted all devices with an audio control/audio streaming interface – you then know all the devices. Have a window with a menu at the top to select the controls for that device. Alternatively have a list on the iconbar icon which opens a window for that device. The actual playing can be left to another program. Another option would be for the control program to be a boot configuration program. The program could set a system variable for the selected sound out device and another for the selected sound in. Another option you may want to consider is that you can run a program when a device is plugged in – dunno if you think that is any use Just my 2p |
Dave Higton (1515) 3526 posts |
Oh, getting the raw information is easy. The problem is to interpret the information, automatically, correctly. I know it’s not all that difficult in principle, but I’m sure I’ll be scratching my head a bit when it comes to the implementation. |
Colin (478) 2433 posts |
Yes – thats why I left it to you :-) Good news about the volume control not crashing. |
jim lesurf (2082) 1438 posts |
If you can explain it for, say, the rdac whose details I put up I will be able to give the program a try when ready. Point to bear in mind for the long term: If you have a software volume control I’d suggest it will be desirable to have the options: A) Convert the 24 bit before applying so you can avoid degrading the resolution. B) Have a clear “unity gain” choice to preserve the ability to ‘pass the parcel’. A gain control is clearly useful. But it has its drawbacks. Jim |
Dave Higton (1515) 3526 posts |
Re. the software volume control: what I’m controlling is a feature in the device itself. I don’t know whether there is such a thing as a clear unity gain choice in any given device. I think that any sort of transcoding of audio, even something as simple as truncating or extending sample word lengths, is some way in the future. |
jim lesurf (2082) 1438 posts |
OK, that’s fine. Decent DACs with their own gain/volume control will do the prodcess with high accuracy. (typically using 32 bit values or larger). BTW Cancel my suggestion of the rdac being an initial ‘target’. The Cambridge Audio DacMagic Plus (whose details I also put up) makes a better target for tests. It provides: A) A set of LEDs that show the arriving/set sample rate. So I can immediately see if the rate is correct without even checking the audio output. B) Has spdif coax and optical outputs. I can connect to that and read the actual sample value stream it is getting. Then compare these with the source material sample-value by sample-value. I can also check and measure the clock rate accuracy and stability. So it gives me much more scope for detecting any problems like the stream having ‘gaps’ or ‘repeated values’ etc. And if it works with that, it will almost certainly work pretty easily with the rest of their range. WRT sample lenghts, the good DACs are happy to accept either 16 or 24 bit. So if possible I’d suggest aiming at being able to send 24bit, and just pad the LS byte for 16bit sources. That way adding in true 24 bit should be easier. BTW To clarify one thing well in advance. A common confusion people make is to think the USB DAC is also responsible for things like being able to handle formats like flac/mp3/whatever. But to avoid any confusion, this remains the job of the ‘host’ machine. The DACs expect LPCM. The format variations are in terms of rate, endian-ness, and how 16 or 24 bits are sent, often ‘padded’ into 32bit signed ints. The second part of that will be clear from the USB info. But the first part is a confusion I’ve seen caused by some statements in magazines or on the web. Cheers, Jim |
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... 52