All of lore.kernel.org
 help / color / mirror / Atom feed
* trident (Hoontech 4d Wave NX) dropouts with small buffersize.
@ 2004-10-05 20:13 Oliver Freyd
  2004-10-07 13:04 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Freyd @ 2004-10-05 20:13 UTC (permalink / raw)
  To: alsa-devel

Hello,

I use snd-trident with OSS emulation to access my soundcard.
Music plays nicely, xmms and the like, but after alsa-0.90
or so the linux games began sounding distorted (like tuxracer,
frozen-bubbles, mirrormagic, all SDL-games that my step-son likes...). 
Now I done some more tests to find out where it comes from:

The games use /dev/dsp, and /proc/asound/card0/pcm0p/sub0/hw_params says:
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 22050 (22050/1)
period_size: 512
buffer_size: 1024
tick_time: 10000

well, you hear drop outs, or even bits of sound repeated, sounds weird
( this doesn't happen with the standard OSS trident driver, BTW)
I guess the game people want the buffer size small for low latency...
Seems it is loosing some interrupts or so...

With xmms, buffer_size is 16384, and all is well...

Well, maybe anyone here on this list has an idea what has happened
in the alsa drivers after 0.90 to trigger this bug.

I'm running debian testing, 
alsa-source-1.0.5a-3
kernel 2.4.26
on a dual celeron 300.

Well, maybe this report can be helpful in further development 
of ALSA...

best regards,

    Oliver Freyd



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-05 20:13 trident (Hoontech 4d Wave NX) dropouts with small buffersize Oliver Freyd
@ 2004-10-07 13:04 ` Takashi Iwai
  2004-10-08  7:15   ` Oliver Freyd
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2004-10-07 13:04 UTC (permalink / raw)
  To: Oliver Freyd; +Cc: alsa-devel

At Tue, 5 Oct 2004 22:13:52 +0200,
Oliver Freyd wrote:
> 
> Hello,
> 
> I use snd-trident with OSS emulation to access my soundcard.
> Music plays nicely, xmms and the like, but after alsa-0.90
> or so the linux games began sounding distorted (like tuxracer,
> frozen-bubbles, mirrormagic, all SDL-games that my step-son likes...). 
> Now I done some more tests to find out where it comes from:
> 
> The games use /dev/dsp, and /proc/asound/card0/pcm0p/sub0/hw_params says:
> access: RW_INTERLEAVED
> format: S16_LE
> subformat: STD
> channels: 2
> rate: 22050 (22050/1)
> period_size: 512
> buffer_size: 1024
> tick_time: 10000
> 
> well, you hear drop outs, or even bits of sound repeated, sounds weird
> ( this doesn't happen with the standard OSS trident driver, BTW)
> I guess the game people want the buffer size small for low latency...
> Seems it is loosing some interrupts or so...
> 
> With xmms, buffer_size is 16384, and all is well...
> 
> Well, maybe anyone here on this list has an idea what has happened
> in the alsa drivers after 0.90 to trigger this bug.

No idea yet, but could you check whether this happens with ALSA native
apps?  For example, you can run aplay with --buffer-size and
--period-size options.  Pass above values to these options and see
whether the playback works.


> I'm running debian testing, 
> alsa-source-1.0.5a-3

It's old :)


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-07 13:04 ` Takashi Iwai
@ 2004-10-08  7:15   ` Oliver Freyd
  2004-10-08 16:39     ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Freyd @ 2004-10-08  7:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Hello Takashi,

thanks for your reply!

On Thu, Oct 07, 2004 at 03:04:34PM +0200, Takashi Iwai wrote:
 
> No idea yet, but could you check whether this happens with ALSA native
> apps?  For example, you can run aplay with --buffer-size and
> --period-size options.  Pass above values to these options and see
> whether the playback works.
> 

Yes, I've tried that now, if play some sound with aplay, without
--buffer-size, it works normal. If I use --period-size 512 and
buffer-size 1024, I get that broken sound. Also with period-size 1024 and 
buffer-size 2048, I think. Only if I use a buffer-size > 2* period-size
if works ok.

> 
> > I'm running debian testing, 
> > alsa-source-1.0.5a-3
> 
> It's old :)
> 
This weekend I'll try to compile the newest alsa-sources :-)

Thanks for your help,

    Oliver



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-08  7:15   ` Oliver Freyd
@ 2004-10-08 16:39     ` Takashi Iwai
  2004-10-09 18:41       ` Oliver Freyd
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2004-10-08 16:39 UTC (permalink / raw)
  To: Oliver Freyd; +Cc: alsa-devel

At Fri, 8 Oct 2004 09:15:06 +0200,
Oliver Freyd wrote:
> 
> Hello Takashi,
> 
> thanks for your reply!
> 
> On Thu, Oct 07, 2004 at 03:04:34PM +0200, Takashi Iwai wrote:
>  
> > No idea yet, but could you check whether this happens with ALSA native
> > apps?  For example, you can run aplay with --buffer-size and
> > --period-size options.  Pass above values to these options and see
> > whether the playback works.
> > 
> 
> Yes, I've tried that now, if play some sound with aplay, without
> --buffer-size, it works normal. If I use --period-size 512 and
> buffer-size 1024, I get that broken sound. Also with period-size 1024 and 
> buffer-size 2048, I think. Only if I use a buffer-size > 2* period-size
> if works ok.

Hmm, how about the bigger period & buffer sizes?  Try both periods=2
and other cases.

The trident driver handles differently when period_size =
buffer_size/2.  If period_size != buffer_size/2, it allocates an extra
voice for the interrupt source.  So, if the bug occurs only with
periods = 2, it narrows the buggy part.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-08 16:39     ` Takashi Iwai
@ 2004-10-09 18:41       ` Oliver Freyd
  2004-10-11 15:27         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Freyd @ 2004-10-09 18:41 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Fri, Oct 08, 2004 at 06:39:50PM +0200, Takashi Iwai wrote:
 
> Hmm, how about the bigger period & buffer sizes?  Try both periods=2
> and other cases.
> 
> The trident driver handles differently when period_size =
> buffer_size/2.  If period_size != buffer_size/2, it allocates an extra
> voice for the interrupt source.  So, if the bug occurs only with
> periods = 2, it narrows the buggy part.
> 
Hello,

I've tried that, I think your idea is right. 
The bug occurs when period_size = buffer_size/2 , also for bigger periods
like 2048 or 4096. Then you can hear that some buffers are repeated,
the soundcard plays them again. If you decrease period_size (even only by 1)
it works nicely. If you increase, you get buffer underruns (aplay detects
them). 

So it seems you have an idea of where the bug could be :-)

If you tell me what else I could do to narrow down the problem,
I'm happy to help you!

  best regards,

    Oliver



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-09 18:41       ` Oliver Freyd
@ 2004-10-11 15:27         ` Takashi Iwai
  2004-10-13 20:02           ` Oliver Freyd
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2004-10-11 15:27 UTC (permalink / raw)
  To: Oliver Freyd; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

At Sat, 9 Oct 2004 20:41:35 +0200,
Oliver Freyd wrote:
> 
> On Fri, Oct 08, 2004 at 06:39:50PM +0200, Takashi Iwai wrote:
>  
> > Hmm, how about the bigger period & buffer sizes?  Try both periods=2
> > and other cases.
> > 
> > The trident driver handles differently when period_size =
> > buffer_size/2.  If period_size != buffer_size/2, it allocates an extra
> > voice for the interrupt source.  So, if the bug occurs only with
> > periods = 2, it narrows the buggy part.
> > 
> Hello,
> 
> I've tried that, I think your idea is right. 
> The bug occurs when period_size = buffer_size/2 , also for bigger periods
> like 2048 or 4096. Then you can hear that some buffers are repeated,
> the soundcard plays them again. If you decrease period_size (even only by 1)
> it works nicely. If you increase, you get buffer underruns (aplay detects
> them). 
> 
> So it seems you have an idea of where the bug could be :-)
> 
> If you tell me what else I could do to narrow down the problem,
> I'm happy to help you!

Ok, to be sure, please try the attached patch.
This will make the driver ignoring the check of 2 periods and always
allocatint an extra voice.


Takashi

[-- Attachment #2: Type: text/plain, Size: 725 bytes --]

Index: alsa-kernel/pci/trident/trident_main.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/trident/trident_main.c,v
retrieving revision 1.59
diff -u -r1.59 trident_main.c
--- alsa-kernel/pci/trident/trident_main.c	30 Jul 2004 12:44:59 -0000	1.59
+++ alsa-kernel/pci/trident/trident_main.c	11 Oct 2004 15:24:30 -0000
@@ -814,7 +814,7 @@
 
 	/* voice management */
 
-	if (params_buffer_size(hw_params) / 2 != params_period_size(hw_params)) {
+	if (1 /*params_buffer_size(hw_params) / 2 != params_period_size(hw_params)*/) {
 		if (evoice == NULL) {
 			evoice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
 			if (evoice == NULL)

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

* Re: trident (Hoontech 4d Wave NX) dropouts with small buffersize.
  2004-10-11 15:27         ` Takashi Iwai
@ 2004-10-13 20:02           ` Oliver Freyd
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Freyd @ 2004-10-13 20:02 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Mon, Oct 11, 2004 at 05:27:32PM +0200, Takashi Iwai wrote:
 
> Ok, to be sure, please try the attached patch.
> This will make the driver ignoring the check of 2 periods and always
> allocatint an extra voice.
> 
> 
> Takashi

Hello Takashi,

I've applied your patch. It works great, no more missed buffers and dropouts
when buffer_size=2*period (tried with aplay).
The games sound nicely, too!!

So your idea was correct. Only thing I don't quite understand is why is there
an extra voice to generate interrupts in the first place, and why not in that
special case. But you'll know why anyway...

well, that's it for now,

   best regards, Oliver


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

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

end of thread, other threads:[~2004-10-13 20:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05 20:13 trident (Hoontech 4d Wave NX) dropouts with small buffersize Oliver Freyd
2004-10-07 13:04 ` Takashi Iwai
2004-10-08  7:15   ` Oliver Freyd
2004-10-08 16:39     ` Takashi Iwai
2004-10-09 18:41       ` Oliver Freyd
2004-10-11 15:27         ` Takashi Iwai
2004-10-13 20:02           ` Oliver Freyd

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.