uaudio - distorted output

2017-10-08 Thread Alexander Leidinger


Hi,

attached are the config descriptors and the device dump of two uaudio  
devices. Both exhibit distorted audio output. It sounds a little bit  
like clipping / not feeding enough samples fast enough...


I played around with dev.pcm.2.bitperfect=1, dev.pcm.2.play.vchans=0,  
dev.pcm.2.play.vchanrate and hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at 4.0  
audio, even when trying to go back to 2.0. I have to usbconfig reset  
the device.


Sometimes (rarely) when playing around I get clear audio output, but  
when I try to reproduce it (going back to default value for the last  
sysctl setting and then going back again to the same setting again),  
the audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the data  
is not delivered fast enough to the uaudio device. But this is a  
dual-socket system with:
CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz (2133.36-MHz  
K8-class CPU)

FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of around  
1, so I would expect CPU/RAM is not an issue here.


I would expect that just attaching an uaudio device like those and  
using madplay/mpg123 would just work (not looking at digital output  
and 5.1/7.1 output for video, just the basics like stereo output of  
MP3). So either I do something fundamentally wrong and would need a  
hint with the cluebat, or I would need some description how to debug  
this further from the USB side...


Bye,
Alexander.

--
http://www.Leidinger.net alexan...@leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.orgnetch...@freebsd.org  : PGP 0x8F31830F9F2772BF
ugen5.2:  at usbus5, cfg=0 md=HOST 
spd=FULL (12Mbps) pwr=ON (308mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0110 
  bDeviceClass = 0x  
  bDeviceSubClass = 0x 
  bDeviceProtocol = 0x 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x041e 
  idProduct = 0x3040 
  bcdDevice = 0x0100 
  iManufacturer = 0x0001  
  iProduct = 0x0002  
  iSerialNumber = 0x  
  bNumConfigurations = 0x0001 

ugen5.2:  at usbus5, cfg=0 md=HOST 
spd=FULL (12Mbps) pwr=ON (308mA)


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x03d3 
bNumInterfaces = 0x0003 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x0080 
bMaxPower = 0x009a 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0001 
  bInterfaceClass = 0x0001  
  bInterfaceSubClass = 0x0001 
  bInterfaceProtocol = 0x 
  iInterface = 0x  

  Additional Descriptor

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


  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
   RAW dump: 
   0x00 | 0x0c, 0x24, 0x02, 0x01, 0x01, 0x01, 0x00, 0x06, 
   0x08 | 0x3f, 0x00, 0x00, 0x00


  Additional Descriptor

  bLength = 0x0e
  bDescriptorType = 0x24
  bDescriptorSubType = 0x06
   RAW dump: 
   0x00 | 0x0e, 0x24, 0x06, 0x02, 0x01, 0x01, 0x03, 0x00, 
   0x08 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00


  Additional Descriptor

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

  Additional Descriptor

  bLength = 0x0c
  bDescriptorType = 0x24
  bDescriptorSubType = 0x02
   RAW dump: 
   0x00 | 0x0c, 0x24, 0x02, 0x04, 0x03, 0x06, 0x00, 0x02, 
   0x08 | 0x03, 0x00, 0x00, 0x00


  Additional Descriptor

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


  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x24
  bDescriptorSubType = 0x03
   RAW dump: 
   0x00 | 0x09, 0x24, 0x03, 0x06, 0x01, 0x01, 0x00, 0x05, 
   0x08 | 0x00

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0083  
bmAttributes = 0x0003  
wMaxPacketSize = 0x0008 
bInterval = 0x000a 
bRefresh = 0x 
bSynchAddress = 0x 


Interface 1
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x0001 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x 
  bInterfaceClass = 0x0001  
  bInterfaceSubClass = 0x0002 
  bInterfaceProtocol = 0x 
  iInterface = 0x  


Interface 1 Alt 1
  bLength = 0

Re: uaudio - distorted output

2017-10-08 Thread Hans Petter Selasky

On 10/08/17 12:56, Alexander Leidinger wrote:


Hi,

attached are the config descriptors and the device dump of two uaudio 
devices. Both exhibit distorted audio output. It sounds a little bit 
like clipping / not feeding enough samples fast enough...


I played around with dev.pcm.2.bitperfect=1, dev.pcm.2.play.vchans=0, 
dev.pcm.2.play.vchanrate and hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at 4.0 
audio, even when trying to go back to 2.0. I have to usbconfig reset the 
device.


Sometimes (rarely) when playing around I get clear audio output, but 
when I try to reproduce it (going back to default value for the last 
sysctl setting and then going back again to the same setting again), the 
audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the data 
is not delivered fast enough to the uaudio device. But this is a 
dual-socket system with:
     CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz (2133.36-MHz 
K8-class CPU)

     FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
     FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of around 1, 
so I would expect CPU/RAM is not an issue here.


Hi,

What version of FreeBSD is this?

Try to enable hw.usb.uaudio.debug=16 during playback.

--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Re: uaudio - distorted output

2017-10-08 Thread Alexander Leidinger


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017  
13:19:19 +0200):



On 10/08/17 12:56, Alexander Leidinger wrote:


Hi,

attached are the config descriptors and the device dump of two  
uaudio devices. Both exhibit distorted audio output. It sounds a  
little bit like clipping / not feeding enough samples fast enough...


I played around with dev.pcm.2.bitperfect=1,  
dev.pcm.2.play.vchans=0, dev.pcm.2.play.vchanrate and  
hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at  
4.0 audio, even when trying to go back to 2.0. I have to usbconfig  
reset the device.


Sometimes (rarely) when playing around I get clear audio output,  
but when I try to reproduce it (going back to default value for the  
last sysctl setting and then going back again to the same setting  
again), the audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the  
data is not delivered fast enough to the uaudio device. But this is  
a dual-socket system with:
    CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz  
(2133.36-MHz K8-class CPU)

    FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
    FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of  
around 1, so I would expect CPU/RAM is not an issue here.


Hi,

What version of FreeBSD is this?


current as of r323636


Try to enable hw.usb.uaudio.debug=16 during playback.


No such sysctl, only hw.usb.debug
I did the hw.usb.debug=16, but no output in dmesg nor  
/var/log/console.log nor /var/log/messages, where do I need to look?


Bye,
Alexander.

--
http://www.Leidinger.net alexan...@leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.orgnetch...@freebsd.org  : PGP 0x8F31830F9F2772BF


pgpWOM__J9anr.pgp
Description: Digitale PGP-Signatur


Re: uaudio - distorted output

2017-10-08 Thread Hans Petter Selasky

On 10/08/17 14:25, Alexander Leidinger wrote:


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017 
13:19:19 +0200):



On 10/08/17 12:56, Alexander Leidinger wrote:


Hi,

attached are the config descriptors and the device dump of two uaudio 
devices. Both exhibit distorted audio output. It sounds a little bit 
like clipping / not feeding enough samples fast enough...


I played around with dev.pcm.2.bitperfect=1, dev.pcm.2.play.vchans=0, 
dev.pcm.2.play.vchanrate and hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at 4.0 
audio, even when trying to go back to 2.0. I have to usbconfig reset 
the device.


Sometimes (rarely) when playing around I get clear audio output, but 
when I try to reproduce it (going back to default value for the last 
sysctl setting and then going back again to the same setting again), 
the audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the 
data is not delivered fast enough to the uaudio device. But this is a 
dual-socket system with:
    CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz (2133.36-MHz 
K8-class CPU)

    FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
    FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of around 
1, so I would expect CPU/RAM is not an issue here.


Hi,

What version of FreeBSD is this?


current as of r323636


Try to enable hw.usb.uaudio.debug=16 during playback.


No such sysctl, only hw.usb.debug
I did the hw.usb.debug=16, but no output in dmesg nor 
/var/log/console.log nor /var/log/messages, where do I need to look?


Bye,
Alexander.



Can you compile and install snd_uaudio module with 
DEBUG_FLAGS="-DUSB_DEBUG" and KMODDIR=/boot/kernel ?


--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Re: uaudio - distorted output

2017-10-08 Thread Alexander Leidinger


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017  
17:28:25 +0200):



On 10/08/17 14:25, Alexander Leidinger wrote:


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017  
13:19:19 +0200):



On 10/08/17 12:56, Alexander Leidinger wrote:


Hi,

attached are the config descriptors and the device dump of two  
uaudio devices. Both exhibit distorted audio output. It sounds a  
little bit like clipping / not feeding enough samples fast  
enough...


I played around with dev.pcm.2.bitperfect=1,  
dev.pcm.2.play.vchans=0, dev.pcm.2.play.vchanrate and  
hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at  
4.0 audio, even when trying to go back to 2.0. I have to  
usbconfig reset the device.


Sometimes (rarely) when playing around I get clear audio output,  
but when I try to reproduce it (going back to default value for  
the last sysctl setting and then going back again to the same  
setting again), the audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the  
data is not delivered fast enough to the uaudio device. But this  
is a dual-socket system with:
    CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz  
(2133.36-MHz K8-class CPU)

    FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
    FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of  
around 1, so I would expect CPU/RAM is not an issue here.


Hi,

What version of FreeBSD is this?


current as of r323636


Try to enable hw.usb.uaudio.debug=16 during playback.


No such sysctl, only hw.usb.debug
I did the hw.usb.debug=16, but no output in dmesg nor  
/var/log/console.log nor /var/log/messages, where do I need to look?


Bye,
Alexander.



Can you compile and install snd_uaudio module with  
DEBUG_FLAGS="-DUSB_DEBUG" and KMODDIR=/boot/kernel ?


Occasionally I get this while playing:
---snip---
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 3680 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 3360 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 4224 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 4096 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
---snip---

The first number on the short transfer varies:
---snip---
# dmesg |grep "transferring 4608 bytes" | wc -l
2738

# dmesg |grep "short transfer" | wc -l
 124

# dmesg |grep "short transfer" | sort | uniq -c
   1 uaudio_chan_play_callback: short transfer, 2176 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 2528 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 2624 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 2848 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 2976 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3008 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3040 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3104 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3136 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3168 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3264 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3296 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3328 of 4608 bytes
   4 uaudio_chan_play_callback: short transfer, 3360 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3424 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3456 of 4608 bytes
   1 uaudio_chan_play_callback: short transfer, 3520 of 4608 bytes
   4 uaudio_chan_play_callback: short transfer, 3552 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3584 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3616 of 4608 bytes
   4 uaudio_chan_play_callback: short transfer, 3648 of 4608 bytes
   2 uaudio_chan_play_callback: short transfer, 3680 of 4608 bytes
   1 uaudio_chan_play_callback: short tr

Re: uaudio - distorted output

2017-10-08 Thread Hans Petter Selasky

On 10/08/17 23:08, Alexander Leidinger wrote:


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017 
17:28:25 +0200):



On 10/08/17 14:25, Alexander Leidinger wrote:


Quoting Hans Petter Selasky  (from Sun, 8 Oct 2017 
13:19:19 +0200):



On 10/08/17 12:56, Alexander Leidinger wrote:


Hi,

attached are the config descriptors and the device dump of two 
uaudio devices. Both exhibit distorted audio output. It sounds a 
little bit like clipping / not feeding enough samples fast enough...


I played around with dev.pcm.2.bitperfect=1, 
dev.pcm.2.play.vchans=0, dev.pcm.2.play.vchanrate and 
hw.snd.latency=1...10.


At some point vchanrate doesn't work anymore, it always stays at 
4.0 audio, even when trying to go back to 2.0. I have to usbconfig 
reset the device.


Sometimes (rarely) when playing around I get clear audio output, 
but when I try to reproduce it (going back to default value for the 
last sysctl setting and then going back again to the same setting 
again), the audio is distorted again.


To me it sounds like some kind of buffer is not big enough or the 
data is not delivered fast enough to the uaudio device. But this is 
a dual-socket system with:
    CPU: Intel(R) Xeon(R) CPU   E5620  @ 2.40GHz 
(2133.36-MHz K8-class CPU)

    FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
    FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
And while playing around with uaudio the system has a load of 
around 1, so I would expect CPU/RAM is not an issue here.


Hi,

What version of FreeBSD is this?


current as of r323636


Try to enable hw.usb.uaudio.debug=16 during playback.


No such sysctl, only hw.usb.debug
I did the hw.usb.debug=16, but no output in dmesg nor 
/var/log/console.log nor /var/log/messages, where do I need to look?


Bye,
Alexander.



Can you compile and install snd_uaudio module with 
DEBUG_FLAGS="-DUSB_DEBUG" and KMODDIR=/boot/kernel ?


Occasionally I get this while playing:
---snip---
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 3680 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 3360 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 4224 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: short transfer, 4096 of 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
uaudio_chan_play_callback: transferring 4608 bytes
---snip---

The first number on the short transfer varies:
---snip---
# dmesg |grep "transferring 4608 bytes" | wc -l
     2738

# dmesg |grep "short transfer" | wc -l
  124

# dmesg |grep "short transfer" | sort | uniq -c
    1 uaudio_chan_play_callback: short transfer, 2176 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 2528 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 2624 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 2848 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 2976 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3008 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3040 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3104 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3136 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3168 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3264 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3296 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3328 of 4608 bytes
    4 uaudio_chan_play_callback: short transfer, 3360 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3424 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3456 of 4608 bytes
    1 uaudio_chan_play_callback: short transfer, 3520 of 4608 bytes
    4 uaudio_chan_play_callback: short transfer, 3552 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3584 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3616 of 4608 bytes
    4 uaudio_chan_play_callback: short transfer, 3648 of 4608 bytes
    2 uaudio_chan_play_callback: short transfer, 3680 of