Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

PC Based Computer music servers, crossovers, and equalization

Linux USB-Audio Gadget (RPi4 OTG)
Linux USB-Audio Gadget (RPi4 OTG)
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 16th September 2019, 07:00 AM   #11
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
Since PA can resample for you, the gadget at its current status switched to adaptive mode should be OK for your project. Lucky you :-)
  Reply With Quote
Old 16th September 2019, 10:20 AM   #12
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by phofman View Post
Since PA can resample for you, the gadget at its current status switched to adaptive mode should be OK for your project. Lucky you :-)
I don't quite understand how PA is going to improve the problems I encountered with a slightly different clock and sample rate on the Pi... After a couple of hours time, will there not be the same under/overrun problems?
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 16th September 2019, 10:26 AM   #13
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
The PA loopback module has a built-in adaptive resampler

Pulseaudio Crossover Rack - multi-way crossover design & implementation with linux + previous
  Reply With Quote
Old 20th September 2019, 01:10 PM   #14
Tfive is offline Tfive  Germany
diyAudio Member
 
Tfive's Avatar
 
Join Date: Jun 2018
Location: Straubing
This might be an interesting read for you:
http://www.thewelltemperedcomputer.c...oh%20story.pdf


It's the story about the design of the (D)PLL for the PCM270X usb adaptive DACs. The author design a fast-locking and then slowly adapting PLL for the chip...


As I said - might be interesting.
  Reply With Quote
Old 20th September 2019, 06:45 PM   #15
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
Thanks a lot, very interesting reading. I do admire the PLL work in USB-adaptive chips. IMO the engineering and know-how behind top quality USB adaptive PLL are much more impressive than async setups which just report fill level of some short buffer back to the sender.

Fortunately in our case we do not have to worry about jitter since all is in the PC. The output clock is independent of the processing (be it soundcard clock in async or USB clock in adaptive). All what counts is the number of samples buffered within the chain must be stable, so that the buffers never hit their limits.
  Reply With Quote
Old 13th December 2019, 04:19 PM   #16
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
With kind help of Minas Harutyunyan from Synopsys (authors of the USB host-gadget IP dwc2 in the Broadcom SoC) I am now running both directions/duplex 64kHz/32bit/32channels bitperfect and no xruns between RPi4 and my linux workstation. The gadget sends/receives 1024 bytes of data every USB highspeed frame 125us (8MB/s in each direction) which is USB audio v.2 maximum achievable rate (1024bytes max packet size for one isochronous endpoint).

RPi overall (4cores) load - idle 98%.

Minor changes in code, suboptimal device-tree config of dwc2.

First step - tick. Now avoiding the gadget alsa devices stall when the USB side is disconnected/idle.
  Reply With Quote
Old 13th December 2019, 10:29 PM   #17
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by phofman View Post
With kind help of Minas Harutyunyan from Synopsys (authors of the USB host-gadget IP dwc2 in the Broadcom SoC) I am now running both directions/duplex 64kHz/32bit/32channels bitperfect and no xruns between RPi4 and my linux workstation. The gadget sends/receives 1024 bytes of data every USB highspeed frame 125us (8MB/s in each direction) which is USB audio v.2 maximum achievable rate (1024bytes max packet size for one isochronous endpoint).

RPi overall (4cores) load - idle 98%.

Minor changes in code, suboptimal device-tree config of dwc2.

First step - tick. Now avoiding the gadget alsa devices stall when the USB side is disconnected/idle.
Nice work by everyone involved! This is really great news. I think the USB audio gadget has some real promise, once all of these kinks are ironed out of the code. This is on the Pi 4, correct? The Pi zero also has OTG but I do not think that is the "Pi" you are testing.

I see you mentioned 64k sample rate. [...I believe that is the default rate of the gadget. I never knew why that was... any ideas? Maybe Minas can provide an answer to that question...] Have you been able to try higher rates over fewer channels?
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 13th December 2019, 10:45 PM   #18
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
I used that samplerate/samplesize/channel count because that combination maxes out the USB2 limit on one isochronous endpoint (in each direction). The gadget does not care about the params, as long as the bitrate is within this limit. It could be e.g. 8.192MHz/8bits/1ch (if that samplerate number fits the usb config descriptor slot).

It's on Pi4. But all the Pis have the same OTG controller, IIUC.
  Reply With Quote
Old 13th December 2019, 10:48 PM   #19
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Ah, I understand now.

But what about the 64kHz rate? That seems to be the default rate for the OTG audio gadget, however, that rate is not supported by any other audio device that I am aware of... it's usually a multiple of 44.1 or 48kHz. Do you think this rate came about because it is the rate that, when used at 32bits and with 32 channels will max out the throughput capability?
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 13th December 2019 at 10:56 PM.
  Reply With Quote
Old 13th December 2019, 11:00 PM   #20
phofman is online now phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
I did not care about the default rate value in the driver, I always specified the params I needed. No idea why the authors used this rate as default. But certainly not because of that maximalization - the driver needs a few minor changes to max it out, and you can reach it with many other combinations, e.g. 512kHz/16bits/8channels.

The reason I needed to test the maximum bitrate was that there was a device tree misconfiguration which prevents larger packet sizes than approx. 900 bytes (out of the 1024 limit). I will push all the patches upstream, when they are ready.
  Reply With Quote

Reply


Linux USB-Audio Gadget (RPi4 OTG)Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
raspberry pi zero as audio gadget on windows thewizard240 PC Based 0 2nd November 2017 08:50 PM
Linux Audio the way to go!? soundcheck PC Based 2286 24th June 2016 10:50 AM


New To Site? Need Help?

All times are GMT. The time now is 09:02 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 14.29%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio
Wiki