OSS with USB DAC: crackles

Hello,

I'm using FreeBSD 10.1 and for sound I own a Cambridge Audio DAC Magic 100 (asynchronous USB).

I've noticed that it makes crackles randomly... I've had the same problem under ArchLinux (ALSA), the solution was to get a refund for the asynchronous that I had USB DAC and buy this one :(

I'd like to avoid resampling (44100:16:2) as all my music collection is FLAC.

I've tried in /etc/sysctl.conf:
Code:
dev.pcm.%d.bitperfect
I still have this issue (plus no way to control volume under VLC?).
Still in /etc/sysctl.conf:
Code:
dev.pcm.0.play.vchanformat=s32le:2.0
dev.pcm.0.play.vchanrate=44100
hw.snd.feeder_rate_quality=4
No way...

Could you help me please ?

I have a last question : When changing a value in /etc/sysctl.conf, must one reboot to apply changes or is there a command line to apply without rebooting?

I thank you for your help,
Nad
 
I can't help you with your problem, but you can reload /etc/sysctl.conf with sysctl -f /etc/sysctl.conf or service sysctl start.

If you are experimenting with sysctl values you can also set them directly with e.g. sysctl dev.pcm.0.play.vchanformat=s32le:2.0.
 
I once had some similar problems with USB sound card. My remedy was to buy a cheap PCI-E USB 3.0 card with a 4-pin power connector. Plugging the USB sound card into any other USB header would result in popping sound when playing music. Plugging it into the USB 3.0 card solved this problem. It may have to do with the poor mains electricity supply that I was living at that time. Since I moved away, I was able to plug my USB sound card into any USB header without encountering any problem. I would suggest trying different power socket in the house. And if you have spare power supply, change it to see if it would make any difference. Of course, you may also try a PCI-E add on card.
 
Hi,

Are you using FreeBSD 9-stable or 10-stable.

Can you dump the USB descriptor of your audio device. There is maybe a bug in the feedback endpoint handling mechanism in FreeBSD causing these crackles.

usbconfig -d X.Y dump_device_desc dump_curr_config_desc

Also:
sysctl hw.usb.uaudio.debug=15
– Plug device.
– Paste uaudio related output from dmesg.

Thank you!

--HPS
 
I have similar problems with a USB S/PDIF output (hiFaceTWO UAC2 M2Tech). I have pops every few seconds. It is externally powered. On this machine I have this problem only since I updated kernel yesterday. 10.1-STABLE #26 r279892. bitperfect, latency and quality sysctls don't make a difference.
I had it on another machine and blamed some USB disks and other periphs, but there is none here and nothing else changed

Code:
# usbconfig -d ugen0.3 dump_device_desc dump_curr_config_desc
ugen0.3: <hiFaceTWO UAC2 M2Tech> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  <Miscellaneous device>
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x249c
  idProduct = 0x930b
  bcdDevice = 0x0661
  iManufacturer = 0x0001  <M2Tech>
  iProduct = 0x0003  <hiFaceTWO UAC2>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0002


 Configuration index 0

  bLength = 0x0009
  bDescriptorType = 0x0002
  wTotalLength = 0x00e7
  bNumInterfaces = 0x0003
  bConfigurationValue = 0x0001
  iConfiguration = 0x0000  <no string>
  bmAttributes = 0x0080
  bMaxPower = 0x0032

  Additional Descriptor

  bLength = 0x08
  bDescriptorType = 0x0b
  bDescriptorSubType = 0x00
  RAW dump:
  0x00 | 0x08, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00


  Interface 0
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x0000
  bAlternateSetting = 0x0000
  bNumEndpoints = 0x0000
  bInterfaceClass = 0x0001  <Audio device>
  bInterfaceSubClass = 0x0001
  bInterfaceProtocol = 0x0020
  iInterface = 0x0003  <hiFaceTWO UAC2>

  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x24
  bDescriptorSubType = 0x01
  RAW dump:
  0x00 | 0x09, 0x24, 0x01, 0x00, 0x02, 0x08, 0x48, 0x00,
  0x08 | 0x00

  Additional Descriptor

  bLength = 0x08
  bDescriptorType = 0x24
  bDescriptorSubType = 0x0a
  RAW dump:
  0x00 | 0x08, 0x24, 0x0a, 0x29, 0x03, 0x07, 0x00, 0x0e


  Additional Descriptor

  bLength = 0x08
  bDescriptorType = 0x24
  bDescriptorSubType = 0x0b
  RAW dump:
  0x00 | 0x08, 0x24, 0x0b, 0x28, 0x01, 0x29, 0x03, 0x0d


  Additional Descriptor

  bLength = 0x11
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
  RAW dump:
  0x00 | 0x11, 0x24, 0x02, 0x02, 0x01, 0x01, 0x00, 0x28,
  0x08 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
  0x10 | 0x06

  Additional Descriptor

  bLength = 0x12
  bDescriptorType = 0x24
  bDescriptorSubType = 0x06
  RAW dump:
  0x00 | 0x12, 0x24, 0x06, 0x0a, 0x02, 0x0f, 0x00, 0x00,
  0x08 | 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00,
  0x10 | 0x00, 0x00


  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x03
  RAW dump:
  0x00 | 0x0c, 0x24, 0x03, 0x14, 0x01, 0x03, 0x00, 0x0a,
  0x08 | 0x28, 0x00, 0x00, 0x00



  Interface 1
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x0001
  bAlternateSetting = 0x0000
  bNumEndpoints = 0x0000
  bInterfaceClass = 0x0001  <Audio device>
  bInterfaceSubClass = 0x0002
  bInterfaceProtocol = 0x0020
  iInterface = 0x0004  <hiFaceTWO UAC2 Output>


  Interface 1 Alt 1
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x0001
  bAlternateSetting = 0x0001
  bNumEndpoints = 0x0002
  bInterfaceClass = 0x0001  <Audio device>
  bInterfaceSubClass = 0x0002
  bInterfaceProtocol = 0x0020
  iInterface = 0x0004  <hiFaceTWO UAC2 Output>

  Additional Descriptor

  bLength = 0x10
  bDescriptorType = 0x24
  bDescriptorSubType = 0x01
  RAW dump:
  0x00 | 0x10, 0x24, 0x01, 0x02, 0x00, 0x01, 0x01, 0x00,
  0x08 | 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10


  Additional Descriptor

  bLength = 0x06
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
  RAW dump:
  0x00 | 0x06, 0x24, 0x02, 0x01, 0x04, 0x18


  Endpoint 0
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0001  <OUT>
  bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
  wMaxPacketSize = 0x00c8
  bInterval = 0x0001
  bRefresh = 0x0000
  bSynchAddress = 0x0000

  Additional Descriptor

  bLength = 0x08
  bDescriptorType = 0x25
  bDescriptorSubType = 0x01
  RAW dump:
  0x00 | 0x08, 0x25, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00


  Endpoint 1
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0081  <IN>
  bmAttributes = 0x0011  <ISOCHRONOUS>
  wMaxPacketSize = 0x0004
  bInterval = 0x0004
  bRefresh = 0x0000
  bSynchAddress = 0x0000


  Interface 1 Alt 2
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x0001
  bAlternateSetting = 0x0002
  bNumEndpoints = 0x0002
  bInterfaceClass = 0x0001  <Audio device>
  bInterfaceSubClass = 0x0002
  bInterfaceProtocol = 0x0020
  iInterface = 0x0004  <hiFaceTWO UAC2 Output>

  Additional Descriptor

  bLength = 0x10
  bDescriptorType = 0x24
  bDescriptorSubType = 0x01
  RAW dump:
  0x00 | 0x10, 0x24, 0x01, 0x02, 0x00, 0x01, 0x01, 0x00,
  0x08 | 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10


  Additional Descriptor

  bLength = 0x06
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
  RAW dump:
  0x00 | 0x06, 0x24, 0x02, 0x01, 0x02, 0x10


  Endpoint 0
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0001  <OUT>
  bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
  wMaxPacketSize = 0x0064
  bInterval = 0x0001
  bRefresh = 0x0000
  bSynchAddress = 0x0000

  Additional Descriptor

  bLength = 0x08
  bDescriptorType = 0x25
  bDescriptorSubType = 0x01
  RAW dump:
  0x00 | 0x08, 0x25, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00


  Endpoint 1
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0081  <IN>
  bmAttributes = 0x0011  <ISOCHRONOUS>
  wMaxPacketSize = 0x0004
  bInterval = 0x0004
  bRefresh = 0x0000
  bSynchAddress = 0x0000


  Interface 2
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x0002
  bAlternateSetting = 0x0000
  bNumEndpoints = 0x0000
  bInterfaceClass = 0x00fe  <Application specific>
  bInterfaceSubClass = 0x0001
  bInterfaceProtocol = 0x0001
  iInterface = 0x000f  <M2Tech DFU>

  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x21
  bDescriptorSubType = 0x07
  RAW dump:
  0x00 | 0x09, 0x21, 0x07, 0xfa, 0x00, 0x40, 0x00, 0x10,
  0x08 | 0x01
 
I also have a similar issue with a Focusrite USB 2.0 audio interface that I just noticed today. Seems there is another user with a similar issue that has filed a PR 198444.
 
Can you try the last "USB audio" patch in PR 198444 ?

--HPS
Hi,

I've just tested the patch on 11-CURRENT r280199. It seems to work quite well for me thus far. Oh, and attached log is post patch. Thanks
 

Attachments

  • dmesg.txt
    95.9 KB · Views: 425
  • usbconfig.txt
    13.7 KB · Views: 448
Hi,

I've just updated 11-current. Could you do a simple listening test? Use SOX for example to playback a pure sine wave, like 300-400Hz. Play it for 1-5 minutes and see if you can hear any phase shifts. The USB audio specification is very silent about how playback only devices should be synchronized when asynchronous isochronous endpoints are used.

--HPS
 
Ok, I've updated 11-CURRENT to r280327. I've created both a 300Hz and 400Hz 3 minute long simple sine wave file. I do notice clicking/popping at 4 to 5 second intervals again on playback however did not notice any other playback anomalies. In case it is relevant, my device is in fact a recording interface however only audio outputs are detected and used under FreeBSD.
 
Could you set:
sysctl hw.usb.uaudio.debug=16
and collect the dmesg while doing this test? Could you also provide output from:
usbconfig -d X.Y dump_device_desc dump_curr_config_desc
Thank you!
 
Could you set:
sysctl hw.usb.uaudio.debug=16
and collect the dmesg while doing this test? Could you also provide output from:
usbconfig -d X.Y dump_device_desc dump_curr_config_desc
Thank you!
Logs attached. Thanks!
 

Attachments

  • dmesg_uaudio_debug_16.txt
    95.9 KB · Views: 285
  • usbconfig.txt
    13.7 KB · Views: 409
One last follow up on my issue even though PR 198444 is now closed. Updated to recent CURRENT and ran tests again. Sound output is perfect with no clicks or pops at all. Thank you! :)
 
Hi, currently I'm on 10.1 stable and there is the same crackle issue with OSS in a USB DAC.
If I upgrade to 11 CURRENT, this issue will be solved, right?
 
Hi, currently I'm on 10.1 stable and there is the same crackle issue with OSS in a USB DAC.
If I upgrade to 11 CURRENT, this issue will be solved, right?

According to the log at PR 198444, the fixes discussed above were already MFC'd to 10.1-STABLE at r280591. If you are on a later revision than that you already have them and may be seeing a new issue.
 
I haven't updated my STABLE installs for a while but there was some changes made to uaudio(4) in r283185 that was MFC'd from HEAD. I did have to change a couple of sysctl knobs on my machine when those changes were pushed to HEAD due to a similar problem though I can't remember what knobs at the moment. I'll take a look in a bit and update my post if I can remember.

Edit: I changed the following sysctl knobs on my machine which fixed a similar issue for me:
Code:
dev.pcm.%d.play.vchanformat
dev.pcm.%d.vchanrate
The values needed are dependent on the hardware being used.
 
Hi protocelt,
I inserted
Code:
dev.pcm.%d.play.vchanformat
dev.pcm.%d.vchanrate
into sysctl.conf and rebooted.

However I still no luck. The problem still remains
Anyone help please.
My sysctl.conf:
Code:
hw.snd.default_unit=4

Indeed it outputted sound of song. But with very much crackles.

Thank you.
 
I've had occasional crackles with my DAC as well, which got fixed with the following in /etc/sysctl.conf:

Code:
hw.snd.feeder_rate_polyphase_max=0
dev.pcm.8.bitperfect=1

Where 8 is my pcm device number.
 
hanhtm, the %d in my previous post represents the device number of your USB device, which from looking at what you posted, would be "4". What is the exact model USB DAC you are using?
 
Back
Top