Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Oct 2017 23:44:27 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Alexander Leidinger <Alexander@leidinger.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: uaudio - distorted output
Message-ID:  <85f5fd9a-2a58-9f5d-6796-716aae617274@selasky.org>
In-Reply-To: <20171008230836.Horde.gG7VyE_62V3bMJX_VtbUrAP@webmail.leidinger.net>
References:  <20171008125631.Horde.ZsqSFDr1-uiT1YrkgH5i0tF@webmail.leidinger.net> <633f23dd-3b61-fe17-b894-6b1221a5dfd4@selasky.org> <20171008142514.Horde.hRkzth4Ur4wvjgUIlWuc70c@webmail.leidinger.net> <21e04dc4-045d-fb30-337a-7f7bd4fe8b50@selasky.org> <20171008230836.Horde.gG7VyE_62V3bMJX_VtbUrAP@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/08/17 23:08, Alexander Leidinger wrote:
> 
> Quoting Hans Petter Selasky <hps@selasky.org> (from Sun, 8 Oct 2017 
> 17:28:25 +0200):
> 
>> On 10/08/17 14:25, Alexander Leidinger wrote:
>>>
>>> Quoting Hans Petter Selasky <hps@selasky.org> (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 transfer, 3712 of 4608 bytes
>     1 uaudio_chan_play_callback: short transfer, 3744 of 4608 bytes
>     4 uaudio_chan_play_callback: short transfer, 3776 of 4608 bytes
>     1 uaudio_chan_play_callback: short transfer, 3808 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 3872 of 4608 bytes
>     3 uaudio_chan_play_callback: short transfer, 3904 of 4608 bytes
>     3 uaudio_chan_play_callback: short transfer, 3936 of 4608 bytes
>     1 uaudio_chan_play_callback: short transfer, 3968 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4032 of 4608 bytes
>    28 uaudio_chan_play_callback: short transfer, 4096 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4128 of 4608 bytes
>     5 uaudio_chan_play_callback: short transfer, 4160 of 4608 bytes
>     8 uaudio_chan_play_callback: short transfer, 4192 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4224 of 4608 bytes
>     3 uaudio_chan_play_callback: short transfer, 4256 of 4608 bytes
>     5 uaudio_chan_play_callback: short transfer, 4288 of 4608 bytes
>     3 uaudio_chan_play_callback: short transfer, 4320 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4352 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4416 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4448 of 4608 bytes
>     3 uaudio_chan_play_callback: short transfer, 4480 of 4608 bytes
>     2 uaudio_chan_play_callback: short transfer, 4544 of 4608 bytes
> ---snip---
> 
> Bye,
> Alexander.
> 

Can you trace that with:

usbdump -i usbusX -f Y -v

?

What rates are supported. Can you try 48000 Hz?

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85f5fd9a-2a58-9f5d-6796-716aae617274>