Subject: News on the underrun bug?

From: amadeus
Date: Sat Mar 11 18:14:29 2006

To: Kohina-UADE-Forum
Are the any news on the underrun bug that uade123/Linux kernel suffers from?

---

From: shd
Date: Mon Mar 20 22:27:32 2006

To: Kohina-UADE-Forum
[quote:1bdcb50691="amadeus"]Are the any news on the underrun bug that uade123/Linux kernel suffers from?[/quote:1bdcb50691]

Testing 2.6.16 soon.

---

From: shd
Date: Wed Mar 22 10:39:06 2006

To: Kohina-UADE-Forum
[quote:552bf20378="amadeus"]Are the any news on the underrun bug that uade123/Linux kernel suffers from?[/quote:552bf20378]

Not on 2.6.16 :( Shit!

---

From: amadeus
Date: Fri Mar 24 02:35:57 2006

To: Kohina-UADE-Forum
[quote:b425e56bf6="shd"]Not on 2.6.16 :( Shit![/quote:b425e56bf6]

What a shame! =(

Would it be possible to implant a --old-engine option until it is fixed in the kernel?

---

From: shd
Date: Fri Mar 24 10:31:50 2006

To: Kohina-UADE-Forum
[quote:697361bf6f="amadeus"][quote:697361bf6f="shd"]Not on 2.6.16 :( Shit![/quote:697361bf6f]

What a shame! =(

Would it be possible to implant a --old-engine option until it is fixed in the kernel?[/quote:697361bf6f]

You can get a patch for 2.6.16 kernel:
 * http://ck.kolivas.org/patches/interactivity/2.6.16-O22.1int.patch

See http://bugme.osdl.org/show_bug.cgi?id=5877 for more discussion.

2.6.17 should be fixed :)

It bothers me that there will be a stable series fork based on 2.6.16, the 2.6.16.*, which will be maintained for 2-3 years, but it will not have that patch. So users of 2.6.16.* will have to apply that patch or upgrade.

I'm not sure, but changing from two pipes to a socket could be a work-around for this problem.

---

From: shd
Date: Fri Mar 24 10:37:40 2006

To: Kohina-UADE-Forum
[quote:1488b7d1a4="shd"]
I'm not sure, but changing from two pipes to a socket could be a work-around for this problem.[/quote:1488b7d1a4]

This patch workarounds the problem. Should work on uade 2.02 at least:

 * http://zakalwe.fi/uade/patches/uade-2.02-siw.diff

Simple instructions:

cd uade-2.02
patch -p0 &lt; /path/to/uade-2.02-siw.diff

It uses a socket instead of two pipes. Of course it can break if Linux kernel developers choose change scheduling policies ;)

Please test this.

---

From: amadeus
Date: Sat Mar 25 00:12:30 2006

To: Kohina-UADE-Forum
[quote:5546a7f257="shd"]Please test this.[/quote:5546a7f257]

It works pretty good with latest cvs. It only makes underruns during the frist seconds of the module. During play does it work perfectly =)

---

From: amadeus
Date: Sat Mar 25 00:16:00 2006

To: Kohina-UADE-Forum
[quote:9c0a54fafb="shd"]I'm not sure, but changing from two pipes to a socket could be a work-around for this problem.[/quote:9c0a54fafb]

I wonder if there are other programs that suffer from this kernel bug. Eventhough it is big change in the kernel code (according to the bug from your link) others most have this problem as well!?

---

From: shd
Date: Sat Mar 25 01:00:51 2006

To: Kohina-UADE-Forum
[quote:641702d5da="amadeus"][quote:641702d5da="shd"]I'm not sure, but changing from two pipes to a socket could be a work-around for this problem.[/quote:641702d5da]

I wonder if there are other programs that suffer from this kernel bug. Eventhough it is big change in the kernel code (according to the bug from your link) others most have this problem as well!?[/quote:641702d5da]

No, most do not show this problem because they're not pipe based.

---

From: shd
Date: Sat Mar 25 10:18:25 2006

To: Kohina-UADE-Forum
[quote:d7faabd6a8="amadeus"]
It only makes underruns during the frist seconds of the module.
[/quote:d7faabd6a8]

Under XMMS, uade123 or both?

---

From: amadeus
Date: Sat Mar 25 13:39:47 2006

To: Kohina-UADE-Forum
[quote:05e47c54dd="shd"]Under XMMS, uade123 or both?[/quote:05e47c54dd]

I haven't got XMMS, so I can't say. But for text mode it does.

---

From: Shd the anon coward
Date: Sat Mar 25 16:29:37 2006

To: Kohina-UADE-Forum
[quote:649dd79a3f="amadeus"]
I haven't got XMMS, so I can't say. But for text mode it does.[/quote:649dd79a3f]

Try this patch against uade123:
 * http://zakalwe.fi/uade/patches/uade-2.02-audiobuffer.diff

cd uade/src/frontends/uade123
patch -p0 &lt; /patchfile

Tell me if it solves the effect. Now it buffers one tenth of a second of samples. You may then edit src/frontends/uade123/audio.c:

#define BUFFERSIZE (UADE_BYTES_PER_SECOND / 10)

to set the buffer size. It's only initial buffering. That's one tenth of a second only. That is the size in bytes.

The amount must be multiple by four. I just found there is a bug in libao with respect to this. libao alsa driver drops partial audio frames (the last 1 - 3 bytes) if write size is not divisible by frame size (4 bytes).

It buffers data only for the beginning of the song. Continuous buffering is achieved by ALSA (or whetever libao uses).

-shd

---

From: amadeus
Date: Sat Mar 25 17:33:17 2006

To: Kohina-UADE-Forum
[quote:758b978edc="Shd the anon coward"]Try this patch against uade123:
 * http://zakalwe.fi/uade/patches/uade-2.02-audiobuffer.diff

[/quote:758b978edc]

I unpached the previous patch and applied this new, and it works!

Thanks =)

[quote:758b978edc="Shd the anon coward"]
Tell me if it solves the effect. Now it buffers one tenth of a second of samples. You may then edit src/frontends/uade123/audio.c:

The amount must be multiple by four.
[/quote:758b978edc]

But 10/4 is not an integer.

I didn't have to change anything, it just worked out of the box =)

[quote:758b978edc="Shd the anon coward"]
I just found there is a bug in libao with respect to this. libao alsa driver drops partial audio frames (the last 1 - 3 bytes) if write size is not divisible by frame size (4 bytes).

[/quote:758b978edc]

Out of curiousity. How large are audio frames?

---

From: shd
Date: Sat Mar 25 20:24:13 2006

To: Kohina-UADE-Forum
[quote:4ba90f1802="amadeus"]
But 10/4 is not an integer.
[/quote:4ba90f1802]

It's rounded down to 2. Integer arithmetics :)

[quote:4ba90f1802]Out of curiousity. How large are audio frames?[/quote:4ba90f1802]

16-bits stereo -&gt; 2 bytes per sample and 2 samples per frame -&gt; frame size is 4 bytes.

---

From: shd
Date: Sat Mar 25 20:26:41 2006

To: Kohina-UADE-Forum
[quote:4613a65ac5]
[/quote:4613a65ac5]

That is, 44100*4/10 = 17640 bytes. And that is divisible by 4 (4410 frames).

---

From: amadeus
Date: Sat Mar 25 20:48:00 2006

To: Kohina-UADE-Forum
[quote:c726318d83="shd"]It's rounded down to 2. Integer arithmetics :)
[/quote:c726318d83]
Of course =)

[quote:c726318d83="shd"]
16-bits stereo -&gt; 2 bytes per sample and 2 samples per frame -&gt; frame size is 4 bytes.[/quote:c726318d83]

Dropping 25%-75% of frame would I put in the ctritical bugs category of libao =)

---

From: amadeus
Date: Sat Mar 25 21:00:44 2006

To: Kohina-UADE-Forum
[quote:bc6c514b14="shd"]That is, 44100*4/10 = 17640 bytes. And that is divisible by 4 (4410 frames).[/quote:bc6c514b14]

Are frames also used for playing e.g. a wave file sampled in 44100Hz,  stereo, 16bit? And what size would that make them? The sample rate for such would be 14112Mb/s.

---

From: shd
Date: Sat Mar 25 21:05:56 2006

To: Kohina-UADE-Forum
[quote:0c2e6dedc9="amadeus"]
Dropping 25%-75% of frame would I put in the ctritical bugs category of libao =)[/quote:0c2e6dedc9]

Not playing something is a bad bug in a library whose only function is to play the given data.

---

From: shd
Date: Sat Mar 25 21:09:23 2006

To: Kohina-UADE-Forum
[quote:37f96a8645="amadeus"]
Are frames also used for playing e.g. a wave file sampled in 44100Hz,  stereo, 16bit? And what size would that make them? The sample rate for such would be 14112Mb/s.[/quote:37f96a8645]

Duh.. Sample rate of that wav is 44100 Hz. Bit rate is 1.4112 Mbit/s. Frame size is just the size of the smallest playable unit. That is, in 16-bit stereo, it's two samples: one 16-bit sample for each channel.

---

From: amadeus
Date: Sat Mar 25 22:27:48 2006

To: Kohina-UADE-Forum
[quote:f4ff73c0af="shd"]Not playing something is a bad bug in a library whose only function is to play the given data.[/quote:f4ff73c0af]

The funny thing about xiph products is that they don't have bugs. They have &quot;tickets&quot;.

http://trac.xiph.org/report/13

So it is not a bug! =)

---

From: amadeus
Date: Sat Mar 25 22:45:13 2006

To: Kohina-UADE-Forum
[quote:5d8b948914="shd"]Duh.. Sample rate of that wav is 44100 Hz. Bit rate is 1.4112 Mbit/s. Frame size is just the size of the smallest playable unit. That is, in 16-bit stereo, it's two samples: one 16-bit sample for each channel.[/quote:5d8b948914]

Sorry about the sample rate / bit rate mix up =)

So the smallest playable unit would be than also be 2B pr. channel?