All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
@ 2020-10-26  7:26 Keith Winstein
  2020-10-26  8:01 ` Keith Winstein
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Winstein @ 2020-10-26  7:26 UTC (permalink / raw)
  To: alsa-devel

Hi folks,

We're using a Zoom UAC-2 USB audio interface, which provides an async
playback endpoint ("1 OUT (ASYNC)") and an async capture endpoint ("2
IN (ASYNC)"), both with 2-channel S32_LE in 44100, 48000, 88200,
96000, 176400, or 192000 samples per second. For whatever reason, the
explicit feedback on the playback endpoint seems a bit unstable and
also biased a little high. alsaloop -t 1000 gets repeated playback
underruns and starts trying to resample the audio to adjust the rate
(even though it's just looping from capture back to playback on the
same device!).

I've found that using implicit feedback produces much more stable
results and doesn't seem to hurt anything else (patch below). I wasn't
sure if the other "implicit feedback quirk" devices in sound/usb/pcm.c
are also ASYNC devices that happen to perform better using implicit
feedback instead (in which case adding the Zoom UAC-2 to the list
seems pretty routine), or if the others are SYNC devices that only
need help identifying the right endpoint and ifnum -- i.e., how
unorthodox is it to use implicit feedback on an ASYNC device?
Hopefully not very.

Please let me know if you'd like any additional information or testing.

Best regards,
Keith

From 2c8d691d39ab2824c344ac2562a1e8605b3384ba Mon Sep 17 00:00:00 2001
From: Keith Winstein <keithw@cs.stanford.edu>
Date: Sun, 25 Oct 2020 22:05:47 -0700
Subject: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2

Signed-off-by: Keith Winstein <keithw@cs.stanford.edu>
Tested-by: Keith Winstein <keithw@cs.stanford.edu>
---
 sound/usb/pcm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index b401ee894e1b..5723e8e69cf1 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -352,6 +352,10 @@ static int set_sync_ep_implicit_fb_quirk(struct
snd_usb_substream *subs,
         ep = 0x81;
         ifnum = 2;
         goto add_sync_ep_from_ifnum;
+    case USB_ID(0x1686, 0xf029): /* ZOOM UAC-2 */
+        ep = 0x82;
+        ifnum = 2;
+        goto add_sync_ep_from_ifnum;
     case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
     case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
         ep = 0x81;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
  2020-10-26  7:26 [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2 Keith Winstein
@ 2020-10-26  8:01 ` Keith Winstein
  2020-10-26 13:52   ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Winstein @ 2020-10-26  8:01 UTC (permalink / raw)
  To: alsa-devel

Here is the patch again without line-wrapping.

From 2c8d691d39ab2824c344ac2562a1e8605b3384ba Mon Sep 17 00:00:00 2001
From: Keith Winstein <keithw@cs.stanford.edu>
Date: Sun, 25 Oct 2020 22:05:47 -0700
Subject: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2

Signed-off-by: Keith Winstein <keithw@cs.stanford.edu>
Tested-by: Keith Winstein <keithw@cs.stanford.edu>
---
 sound/usb/pcm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index b401ee894e1b..5723e8e69cf1 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -352,6 +352,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
 		ep = 0x81;
 		ifnum = 2;
 		goto add_sync_ep_from_ifnum;
+	case USB_ID(0x1686, 0xf029): /* ZOOM UAC-2 */
+		ep = 0x82;
+		ifnum = 2;
+		goto add_sync_ep_from_ifnum;
 	case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
 	case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
 		ep = 0x81;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
  2020-10-26  8:01 ` Keith Winstein
@ 2020-10-26 13:52   ` Takashi Iwai
  2020-10-27  7:18     ` Keith Winstein
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2020-10-26 13:52 UTC (permalink / raw)
  To: Keith Winstein; +Cc: alsa-devel

On Mon, 26 Oct 2020 09:01:43 +0100,
Keith Winstein wrote:
> 
> Here is the patch again without line-wrapping.

Could you put the patch description in the patch itself?
Basically I'm fine to merge this as is, just missing information for
git.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
  2020-10-26 13:52   ` Takashi Iwai
@ 2020-10-27  7:18     ` Keith Winstein
  2020-10-27  7:27       ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Winstein @ 2020-10-27  7:18 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Mon, Oct 26, 2020 at 02:52:28PM +0100, Takashi Iwai wrote:
> On Mon, 26 Oct 2020 09:01:43 +0100,
> Keith Winstein wrote:
> > 
> > Here is the patch again without line-wrapping.
> 
> Could you put the patch description in the patch itself?
> Basically I'm fine to merge this as is, just missing information for
> git.

Sure, here you go:

From 51fac91fa3a5da656ca6a49ca6cc98be7664efd7 Mon Sep 17 00:00:00 2001
From: Keith Winstein <keithw@cs.stanford.edu>
Date: Sun, 25 Oct 2020 22:05:47 -0700
Subject: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2

The Zoom UAC-2 USB audio interface provides an async playback endpoint ("1 OUT (ASYNC)") and
capture endpoint ("2 IN (ASYNC)"), both with 2-channel S32_LE in 44.1, 48, 88.2, 96, 176.4,
or 192 kilosamples/s. The device provides explicit feedback to adjust the host's playback
rate, but the feedback appears unstable and biased relative to the device's capture rate.
"alsaloop -t 1000" experiences playback underruns and tries to resample the captured audio
to match the varying playback rate. Forcing the kernel to use implicit feedback appears to
produce more stable results. This causes the host to transmit one playback sample for each
capture sample received. (Zoom North America has been notified of this change.)

Signed-off-by: Keith Winstein <keithw@cs.stanford.edu>
Tested-by: Keith Winstein <keithw@cs.stanford.edu>
---
 sound/usb/pcm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index b401ee894e1b..31b1edf53c41 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -352,6 +352,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
 		ep = 0x81;
 		ifnum = 2;
 		goto add_sync_ep_from_ifnum;
+	case USB_ID(0x1686, 0xf029): /* Zoom UAC-2 */
+		ep = 0x82;
+		ifnum = 2;
+		goto add_sync_ep_from_ifnum;
 	case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
 	case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
 		ep = 0x81;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
  2020-10-27  7:18     ` Keith Winstein
@ 2020-10-27  7:27       ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-10-27  7:27 UTC (permalink / raw)
  To: Keith Winstein; +Cc: alsa-devel

On Tue, 27 Oct 2020 08:18:41 +0100,
Keith Winstein wrote:
> 
> On Mon, Oct 26, 2020 at 02:52:28PM +0100, Takashi Iwai wrote:
> > On Mon, 26 Oct 2020 09:01:43 +0100,
> > Keith Winstein wrote:
> > > 
> > > Here is the patch again without line-wrapping.
> > 
> > Could you put the patch description in the patch itself?
> > Basically I'm fine to merge this as is, just missing information for
> > git.
> 
> Sure, here you go:
> 
> >From 51fac91fa3a5da656ca6a49ca6cc98be7664efd7 Mon Sep 17 00:00:00 2001
> From: Keith Winstein <keithw@cs.stanford.edu>
> Date: Sun, 25 Oct 2020 22:05:47 -0700
> Subject: [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
> 
> The Zoom UAC-2 USB audio interface provides an async playback endpoint ("1 OUT (ASYNC)") and
> capture endpoint ("2 IN (ASYNC)"), both with 2-channel S32_LE in 44.1, 48, 88.2, 96, 176.4,
> or 192 kilosamples/s. The device provides explicit feedback to adjust the host's playback
> rate, but the feedback appears unstable and biased relative to the device's capture rate.
> "alsaloop -t 1000" experiences playback underruns and tries to resample the captured audio
> to match the varying playback rate. Forcing the kernel to use implicit feedback appears to
> produce more stable results. This causes the host to transmit one playback sample for each
> capture sample received. (Zoom North America has been notified of this change.)
> 
> Signed-off-by: Keith Winstein <keithw@cs.stanford.edu>
> Tested-by: Keith Winstein <keithw@cs.stanford.edu>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-27  7:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26  7:26 [PATCH] ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2 Keith Winstein
2020-10-26  8:01 ` Keith Winstein
2020-10-26 13:52   ` Takashi Iwai
2020-10-27  7:18     ` Keith Winstein
2020-10-27  7:27       ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.