Open-source USB interface: Audio Widget - Page 100 - diyAudio
Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

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 26th January 2012, 06:26 PM   #991
1audio is offline 1audio  United States
diyAudio Member
 
Join Date: Mar 2004
Location: SF Bay Area
Blog Entries: 3
ALSA update. I compiled and installed the latest version of ALSA (1.0.25) to see if it addressed any of the USB playback issues I have encountered. Unfortunately, no, they are still there.

Regardless, its probably a good move to update if you can. Don't make this your first Linux project, however. It can be quite daunting if you are not setup and have all the pieces sorted out.
__________________
Demian Martin
Product Design Services
  Reply With Quote
Old 26th January 2012, 09:14 PM   #992
rsdio is offline rsdio  United States
diyAudio Member
 
Join Date: Feb 2008
Location: Seattle
Quote:
Originally Posted by borges View Post
I'm responding to post 624 with a new schematic. Does this USB circuit make more sense to you?
Yes! I see nothing wrong with that new schematic.

There are a few things you could add, but most of them are probably overkill. The one thing that might be useful is a second capacitor across VBUS and GND after the ferrite bead filters but close to them on the PCB. Value would be between 0.1 ĶF to 0.01 ĶF. Since noise is your primary concern, that small addition should not hurt.

Other additions I've seen are a 6.2 V Zener to protect against excessive VUSB, but it seems unlikely that any modern USB Host would put out more than 5.25 V.

I see that you have ESD suppressors on the USB data lines. That seems like a good idea but I've never seen it or used it, so I can't say for sure.

Good work!
  Reply With Quote
Old 26th January 2012, 09:24 PM   #993
diyAudio Member
 
Onvinyl's Avatar
 
Join Date: Aug 2002
Location: Germany
Quote:
Originally Posted by 1audio View Post
to see if it addressed any of the USB playback issues I have encountered. Unfortunately, no, they are still there.
Which are your issues? The only thing that happens here occasionally is a 'hang up', probably due to a buffer undderun that sounds like a hanging CD.

RŁdiger
__________________
"I can feel what's going on inside a piece of electronic equipment. I have a sense that I know what's going on inside the transistors." Robert Moog
  Reply With Quote
Old 26th January 2012, 10:33 PM   #994
diyAudio Member
 
jeff mai's Avatar
 
Join Date: Aug 2002
Location: Melbourne
Quote:
Originally Posted by borges View Post

When you stream from the PC, are you sending music data from a Windows environment?

BÝrge
The latest Voyage supports NFS and CIFS. So adding Windows shares to fstab is no problem, but I had to additionally apt-get install winbind for some reason I can't recall.
  Reply With Quote
Old 27th January 2012, 12:05 AM   #995
1audio is offline 1audio  United States
diyAudio Member
 
Join Date: Mar 2004
Location: SF Bay Area
Blog Entries: 3
The one problem I still have and Alex is aware of it is that a sample rate upshift from 44.1 to 88.2 confuses the firmware and it goes to some other sample rate. a pause and then play fixes the issue but it can be jarring. I wanted to see if the fixes in the latest Alsa addressed this in any way.
__________________
Demian Martin
Product Design Services
  Reply With Quote
Old 27th January 2012, 12:27 AM   #996
MrSlim is offline MrSlim  Canada
diyAudio Member
 
Join Date: Jun 2009
Location: Ottawa, Ontario
Blog Entries: 2
Quote:
Originally Posted by 1audio View Post
The one problem I still have and Alex is aware of it is that a sample rate upshift from 44.1 to 88.2 confuses the firmware and it goes to some other sample rate. a pause and then play fixes the issue but it can be jarring. I wanted to see if the fixes in the latest Alsa addressed this in any way.
Does the issue occur when the sample rate shifts between discrete pieces of music, or only when the rate shifts during a piece?
  Reply With Quote
Old 27th January 2012, 12:38 AM   #997
diyAudio Member
 
Join Date: Apr 2011
I am now looking at whether the automatic rate feedback format detection logic in the alsa driver interacting with the widget firmware is causing the issue. So far the specific issue has never been reported with Win or OSX.

My plan is to investigate with two approaches:

1. Look at the alsa source code;
2. Use WireShark to see the USB exchanges between driver and firmware.

However it will take some time as I am busy with another project at the moment :-)

Alex
  Reply With Quote
Old 27th January 2012, 03:22 AM   #998
diyAudio Member
 
Join Date: Apr 2011
Default Interactions between mpd --> alsa uac2 driver ---> widget firmware

Hi Demian et al,

OK. The following is rather complicated but if you are interested enough you are welcome to read through. I still need to do the WireShark dump to confirm the following conjecture before forwarding the info to Daniel Mack.

1 In the alsa driver sound/usb/urb.c the following code fragment checks the rate feedback value:

if (unlikely(subs->freqshift == INT_MIN)) {
/*
* The first time we see a feedback value, determine its format
* by shifting it left or right until it matches the nominal
* frequency value. This assumes that the feedback does not
* differ from the nominal value more than +50% or -25%.
*/
shift = 0;
while (f < subs->freqn - subs->freqn / 4) {
f <<= 1;
shift++;
}
while (f > subs->freqn + subs->freqn / 2) {
f >>= 1;
shift--;
}
subs->freqshift = shift;
}
else if (subs->freqshift >= 0)
f <<= subs->freqshift;
else
f >>= -subs->freqshift;

if (likely(f >= subs->freqn - subs->freqn / 8 && f <= subs->freqmax)) {
/*
* If the frequency looks valid, set it.
* This value is referred to in prepare_playback_urb().
*/
spin_lock_irqsave(&subs->lock, flags);
subs->freqm = f;
spin_unlock_irqrestore(&subs->lock, flags);
} else {
/*
* Out of range; maybe the shift value is wrong.
* Reset it so that we autodetect again the next time.
*/
subs->freqshift = INT_MIN;
}


2 Now my hypothesis is that mpd changes the sampling rate when playing back mixed sampling rate albums without some sequence such as stop -> inform change freq -> restart. Thus alsa driver follows the above code fragment.

3. Now the rate feedback format used in the widget firmware (which proves to be compatible with Win and OSX) is 10.14 in 3 bytes, or 18.14 in 4 bytes.

4. The internal sampling freq format used in alsa uac2 is 16.16 in 4 bytes. So the CORRECT shift for the rate feedback format should be shift left by 2 bits, or multiply by 4.

4. Scenario when playing 96khz music and then skips to 44.1khz music:

Playing 96khz:
subs->freqn is 96khz or 96 * 2^16 in 16.16 format
rate feedback is 96khz or 96 * 2^14 in 18.14 format

Switch to 44.1khz without informing alsa:
subs->freqn is still 96hz or 96* 2^16
rate feedback is now 44.1 * 2 ^14

If rate feedback is shifted left by 2 bits:

44.1 * 2^14 *4 = 176.4 * 2 ^ 14

This is compared to (subs->freqn - subs->freqn / 4) or 72 * 2^16 or 288 * 2^14

This works.
,

If rate feedback is shifted by 3 bits (trial & error done in the code)

44.1 * 2^14 *8 = 352.8 * 2^14 which is bigger than 288 * 2^14 above.

Thus the code CORRECTLY decides that shift left by 2 bits is OK.

It then updates the actual frequency used:

subs->freqm = f;

5. So the scenario of 96khz ---> 44.1khz works.

6. Now the next scenario of 44.1khz skips to 96khz.

7. Playing 44.1khz:

subs->freqn is 44.1khz or 44.1 * 2^16
rate feedback is 44.1khz or 44.1 * 2^14

Now mpd changes sampling rate to 96khz without stop -> change freq -> restart sequence:

subs->freqn is still 44.1 * 2^16
rate feedback changes to 96khz or 96 * 2^14

Alsa code checks:

lower bound of 44.1 *2^16 - (44.1 * 2^16 /4) = 33.075 * 2^16 = 132.3 * 2^14

How many shifts are needed for 96 * 2^14 to be just < 132.3 * 2^14 ?

The answer is NONE, or 0.

The new computed freq is 96 * 2^14, or 24 * 2^16, or 24khz. This is obviously wrong. So the last section of the code rejects it and subs->freqm (the modified freq as opposed to the nominal freq of subs->freqn) is NOT changed. So rate feedback fails to sync.

8. To actually PROVE my hypothesis above, there are several steps required:

(a) check mpd code --> alsa driver to confirm that mpd does not inform alsa driver of change in sampling rate when skipping, or mpd informs, but alsa driver does not update subs->freqn accordingly etc.

(b) disable the uac2 driver's automatic feedback rate format detection and replace it with a fixed 18.14 format. (This will test whether it works with widget firmware, but it will probably break the alsa driver when using other soundcards which use a different format, such as 12.13 etc.)

9 If the above hypothesis is true, WireShark dump of the USB transactions will not help with the debugging, as the USB transactions are all corrrect.

10. It is interesting to note that with mpd, you can restore the sampling rate sync by stopping (or pausing) and restarting the stream. So a mod to mpd to ALWAYS issue a stop and restart before changing sampling rate should cure the problem as well.

Alex
  Reply With Quote
Old 27th January 2012, 05:41 AM   #999
1audio is offline 1audio  United States
diyAudio Member
 
Join Date: Mar 2004
Location: SF Bay Area
Blog Entries: 3
I have tried to duplicate the problem in Windows but none of the Windows programs I have tried so far switch tracks as fast. With MPD I can cue up a set of 5 second audio clips in different sample rates and they play without a hesitation. I have tried similar with the command line on Linux as well and hit the same problem. Is there a command line tool for playing audio tracks for Windows?

Do you need to accept such a wide different in sample rates when testing? There are really only 6 possible sample rates to support so it may work with a different algorithm that looks for only the possible valid options when the frequency changes.

I have access to 3 different async USB DAC + the AB1.1. I will be getting the MC6631 demo board soon. I can try a number of options with this.

Feedback format-is this a clue?
Feedback Format = 15.17 when its working
Feedback Format = 16.16 when its not working right
__________________
Demian Martin
Product Design Services
  Reply With Quote
Old 27th January 2012, 05:48 AM   #1000
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Post 1000 !!!!

BÝrge
  Reply With Quote

Reply


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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Async 192Khz USB - the SDR-Widget collaborative project SunRa PC Based 5 26th April 2011 06:38 PM
usb audio interface david12 Equipment & Tools 14 10th October 2010 02:58 AM
Cheap Audio Interface (USB?) to PC agm2003 Instruments and Amps 11 16th September 2007 07:48 AM
Open call for suggestions on Open Source DIY Audio Design gfergy Everything Else 1 15th April 2007 07:33 AM
USB Interface Perfect?- Computer Audio fmak Digital Source 3 4th December 2004 10:24 PM


New To Site? Need Help?

All times are GMT. The time now is 10:04 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2