Ultralite AVB

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

supereb
Established Member
Posts: 93
Joined: Fri Aug 17, 2018 10:55 pm
Has thanked: 36 times
Been thanked: 5 times

Re: Ultralite AVB

Post by supereb »

bluebell wrote: Sun Dec 10, 2023 9:23 pm

On my machine I use hw:0 with jack, not hw:0,0 and it works.

Pulseaudio makes no problems since I configured it to use jack_sink and never try to access the Ultralite directly.

See also http://marzen.de/Holger/pulseaudio_and_jack/

One reason having problems to use ALSA may be a system wide redirection of ALSA clients to Pulseaudio. But configuring Pulseaudio to use jack cures all problems. On my system I can show it with "aplay -L": The "default" setting is redirecting ALSA clients to Pulseaudio.

Code: Select all

hm@bubu:~$ aplay -L
default
    Playback/recording through the PulseAudio sound server
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=MOTUAVB
    MOTU-AVB, MOTU-AVB
    Default Audio Device
dmix:CARD=MOTUAVB,DEV=0
    MOTU-AVB, MOTU-AVB
    Direct sample mixing device
dsnoop:CARD=MOTUAVB,DEV=0
    MOTU-AVB, MOTU-AVB
    Direct sample snooping device
hw:CARD=MOTUAVB,DEV=0
    MOTU-AVB, MOTU-AVB
    Direct hardware device without any conversions
plughw:CARD=MOTUAVB,DEV=0
    MOTU-AVB, MOTU-AVB
    Hardware device with all software conversions

Thanks Bluebell, this very helpful information!

buonamorte.records
Established Member
Posts: 100
Joined: Tue Apr 07, 2020 4:31 am
Has thanked: 11 times
Been thanked: 11 times

Re: Ultralite AVB

Post by buonamorte.records »

Hi and happy 2024! A question: can i install the patch-6.0.3 by @AudioNarwhal on a 6.6.6 kernel?

buonamorte.records
Established Member
Posts: 100
Joined: Tue Apr 07, 2020 4:31 am
Has thanked: 11 times
Been thanked: 11 times

Re: Ultralite AVB

Post by buonamorte.records »

In the thread about the new motu 828, great news for us from Motu! Unofficial but...great!

"Jared from MOTU here in a totally unofficial capacity - I was really happy to see the level of excitement about the new 828 in Linux circles! To try to help you guys out, I put together this unofficial build of CueMix 5 for Linux in my spare time that should allow you to control your 828 while it's plugged into a Linux computer. To use it, just go into the build folder and run com.motu.CueMix5.

https://drive.google.com/file/d/1WFhmTM ... sp=sharing MD5 Sum: 9479774d594ca9f5e80c876fd62eacb3

This should work for local control of both UltraLite-mk5 and 828 devices - For UltraLite-mk5, it should show up on the discovery page; for the 828, you'll need to click the gear icon and choose "Enable WebMIDI".

Would love to hear how it goes if it's helpful for anyone!"

buonamorte.records
Established Member
Posts: 100
Joined: Tue Apr 07, 2020 4:31 am
Has thanked: 11 times
Been thanked: 11 times

Re: Ultralite AVB

Post by buonamorte.records »

I can't understand why but my 828es with 1.4.5 firmware and without patches is working perfectly...but my ultralite avb es doesn't...bah!

User avatar
sh7d
Established Member
Posts: 4
Joined: Fri Mar 01, 2024 9:38 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Ultralite AVB

Post by sh7d »

I was able to get working my Motu 16A under linux 6.7.7 using the following patch applied to the kernel:

Code: Select all

diff --git a/sound/usb/card.h b/sound/usb/card.h
index 6ec95b2ed..c3dbc9c16 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -91,9 +91,10 @@ struct snd_usb_endpoint {
 	struct snd_usb_packet_info {
 		uint32_t packet_size[MAX_PACKS_HS];
 		int packets;
-	} next_packet[MAX_URBS];
+	} next_packet[MAX_URBS + 2];
 	unsigned int next_packet_head;	/* ring buffer offset to read */
 	unsigned int next_packet_queued; /* queued items in the ring buffer */
+	unsigned int startup_wait_urbs; /* number of capture URBS - 1 before starting playback for implicit feedback */
 	struct list_head ready_playback_urbs; /* playback URB FIFO for implicit fb */
 
 	unsigned int nurbs;		/* # urbs */
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index a676ad093..90b8875bf 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -180,7 +180,8 @@ static bool uac_clock_source_is_valid_quirk(struct snd_usb_audio *chip,
 	 * Sample rate changes takes more than 2 seconds for this device. Clock
 	 * validity request returns false during that period.
 	 */
-	if (chip->usb_id == USB_ID(0x07fd, 0x0004)) {
+	if (chip->usb_id == USB_ID(0x07fd, 0x0004) || 
+		chip->usb_id == USB_ID(0x07fd, 0x0005)) {
 		count = 0;
 
while ((!ret) && (count < 50)) {
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 8f65349a0..91c99674b 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -468,8 +468,10 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
 		int err, i;
 
	spin_lock_irqsave(&ep->lock, flags);
-		if ((!implicit_fb || ep->next_packet_queued > 0) &&
+		if ((!implicit_fb || ep->next_packet_queued > ep->startup_wait_urbs) &&
 		    !list_empty(&ep->ready_playback_urbs)) {
+			/* once started stop waiting */
+			ep->startup_wait_urbs = 0;
 			/* take URB out of FIFO */
 			ctx = list_first_entry(&ep->ready_playback_urbs,
 					       struct snd_urb_ctx, ready_list);
@@ -1588,7 +1590,9 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
 
 	if (snd_usb_endpoint_implicit_feedback_sink(ep) &&
 	    !(ep->chip->quirk_flags & QUIRK_FLAG_PLAYBACK_FIRST)) {
-		usb_audio_dbg(ep->chip, "No URB submission due to implicit fb sync\n");
+		printk(KERN_INFO "MOTU Patch - 6.0.3");
+		usb_audio_dbg(ep->chip, "Delaying URB submission due to implicit fb sync\n");
+		ep->startup_wait_urbs = ep->nurbs - 1;
 		i = 0;
 		goto fill_rest;
 	}

There are two issues with the motu avb devices family:

  1. Sample rate cannot be changed too fast (and if is changed too fast there will be errors printed in dmesg)

  2. Need of the wait of URB submission for implicit fb sync

For the first issue there is already workaround in the kernel for that, but is activated by default only for the MOTU MicroBook II device.
For the second issue - the patch was already provided in this thread for fixing it

Observation: by fixing implicit fb sync issue device cannot play any sound for ~ 2 seconds after it is opened/activated by software - but since DAWs are activating device for the entire time since DAW startup - that is absolutely no issue in the context of musical production usage. Also for the casual usage pulseaudio should be able to make the device always opened by disabling module module-suspend-on-idle.

I guess it should be possible to upstream that patch (and even add more supported devices from the avb family) by implementing proper device quirks, but I'm not a c programmer :)

Last edited by sh7d on Sat Mar 02, 2024 5:17 pm, edited 4 times in total.
buonamorte.records
Established Member
Posts: 100
Joined: Tue Apr 07, 2020 4:31 am
Has thanked: 11 times
Been thanked: 11 times

Re: Ultralite AVB

Post by buonamorte.records »

Hi @sh7d , is there a way to apply this patch out of the tree? I don't really know exactly how it work but i've understood that by this way you can jump the compilation of the kernel every time...is that true?

User avatar
sh7d
Established Member
Posts: 4
Joined: Fri Mar 01, 2024 9:38 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Ultralite AVB

Post by sh7d »

buonamorte.records wrote: Mon Mar 25, 2024 10:18 pm

Hi @sh7d , is there a way to apply this patch out of the tree? I don't really know exactly how it work but i've understood that by this way you can jump the compilation of the kernel every time...is that true?

There is possibility to build only a selected subsystem for the kernel (example howto about that for arch linux) and to install built modules for that subsystem only and since subsystems have strong dependency to specific kernel version maybe you can use dkms to automate entire process during new kernel installation.
You can take inspiration from this blog entry but personally I'm too lazy to apply it for my personal desktop :) I just installed separated patched kernel alongside other ones, so if i want to record something from my 16A it's a matter of rebooting os to the patched kernel version.
If you want to try experimenting with the dkms method please be aware that method provided by mentioned blog entry is for ubuntu specific, and is for btusb subsystem - the exact method that you should create for yourself depends of the distribution that you are actually using

Last edited by sh7d on Mon Mar 25, 2024 11:22 pm, edited 2 times in total.
User avatar
sh7d
Established Member
Posts: 4
Joined: Fri Mar 01, 2024 9:38 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Ultralite AVB

Post by sh7d »

Also, i found a very interesting email on alsa-devel mailing lists:
https://lore.kernel.org/alsa-devel/alpi ... marzen.de/
It's a shame how the support of the avb product line was so close to be upstreamed (or at least to be noticed by alsa devs), but it was simply ignored :(

Post Reply