Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[WORKAROUND] OSS4 Audigy4 garbled sound
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Fri Sep 17, 2010 12:44 pm    Post subject: [WORKAROUND] OSS4 Audigy4 garbled sound Reply with quote

NOTE: There is a workaround. Read last or last few posts

After setting up OSS4 with certain measure of blood, sweat and headache it works -- well sort of.

The Problem:
The thing is that when a sound application reconnects to (disconnects/closes and then connects/opens) /dev/dsp
sometimes sound is missing or sometimes worse - digital noise at max volume comes out.

For example mpd disconnects from /dev/dsp when it changes song (so I get pretty good chance of no music or shitting my pants with noise at incredible volume).

Peculiarly enough according to ossinfo -v the vmix disconnects from sound device as well, when there's no client apps. Even more it shows both vmix and my client app as using "sound engines". From which I deduct it uses HW mixing capability of sound card (which doesn't seem to be well supported).

Info:
I'm running a Creative SB Audigy4 (which uses oss_sblive driver)
My OSS is an slightly modified oss-4.2.2002.ebuild from Bugzilla
More info on my previous topic about setting up the thing.

Probable solutions:
Well from what I can understand I need to do whole mixing in software and then pass to sound device thru persistent connection.

If not, I guess I need a secondary sound server. Well I like JACK, but it doesn't play nice with oss on non-realtime kernel (dunno if on realtime one either), so unless you have good ideas it's a no go too.
Then there is Pulseaudio. I've had nothing but headache in the past (w/ Ubuntu), but as for general use sound server there is nothing much else (what ain't old or/and deprecated).


So, is anyone else having this bug?
Can I and how to configure vmix to remain constantly hooked up to the device?
Or should I use a secondary sound server?

EDIT: I just realised that the noise is in fact a tiny (perhaps a single sound frame?) piece of input sound stuck in looping. So when there is "sound missing" it is actually a "silent piece" looping itself over again, instead of really missing sound.
_________________
"I reject your reality and substitute my own" - A. Savage


Last edited by JohnLM on Tue May 17, 2011 11:52 am; edited 3 times in total
Back to top
View user's profile Send private message
soka
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2006
Posts: 79
Location: Argentina

PostPosted: Mon Sep 27, 2010 12:28 pm    Post subject: Reply with quote

I had a similar problem with an audigy 4 some time ago, check my post at 4front-tech.com and see if it can help you.
http://www.4front-tech.com/forum/viewtopic.php?f=3&t=3932
Back to top
View user's profile Send private message
Naib
Advocate
Advocate


Joined: 21 May 2004
Posts: 4076
Location: Removed by Neddy

PostPosted: Mon Sep 27, 2010 10:21 pm    Post subject: Reply with quote

isn't /dev/dsp the legacy oss interface and you should be jacking into the newer ossv4 /dev nodes?
_________________
A free press is the unsleeping guardian of every other right that free men prize; it is the most dangerous foe of tyranny. Where men have the habit of liberty, the Press will continue to be the vigilant guardian of the rights of the ordinary citizen.
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Wed Sep 29, 2010 10:47 pm    Post subject: Reply with quote

Naib wrote:
isn't /dev/dsp the legacy oss interface and you should be jacking into the newer ossv4 /dev nodes?

Nope. /dev/dsp is just a symlink to the oss4 nodes. The connection point is irrelevant.

soka wrote:
I had a similar problem with an audigy 4 some time ago, check my post at 4front-tech.com and see if it can help you.
http://www.4front-tech.com/forum/viewtopic.php?f=3&t=3932

Sounds just like the thing!
The linked topic says you're running b2003, which I would guess is a "out of portage" build. Right?

EDIT: No luck. I built whatever seems to 2003 build. For some reason ossinfo thinks different. It says it's simply a later 2002 (b 2002 / 201009131513) build.
Bug remains.

Hmm there was a diff file in the linked topic, but it seems to be expired.

What are you using now soka?
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Mon Nov 01, 2010 10:38 am    Post subject: Reply with quote

Just installed the mercurial build of OSS 4.2 (b 2003/201010311349)
Testing it two days now, and it doesn't seem to get rid of the problem completely.
Sound is sometimes still missing, but it is playing more often than not, so it's a good change.
Hadn't had the beep/noise bug yet, but a there's a new one... some extra harmonics over an actual sound.

What do you guys think of Pulseaudio instead of vmix for mixing?
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
Naib
Advocate
Advocate


Joined: 21 May 2004
Posts: 4076
Location: Removed by Neddy

PostPosted: Mon Nov 01, 2010 10:54 am    Post subject: Reply with quote

JohnLM wrote:
Just installed the mercurial build of OSS 4.2 (b 2003/201010311349)
Testing it two days now, and it doesn't seem to get rid of the problem completely.
Sound is sometimes still missing, but it is playing more often than not, so it's a good change.
Hadn't had the beep/noise bug yet, but a there's a new one... some extra harmonics over an actual sound.

What do you guys think of Pulseaudio instead of vmix for mixing?


pretty good these days.

I went to ossv4 because ALSA was crap and pa at the time was a POS.
an app I wanted to use (mangler) was PA-only when it 1st got released so I converted back and was surprised
_________________
A free press is the unsleeping guardian of every other right that free men prize; it is the most dangerous foe of tyranny. Where men have the habit of liberty, the Press will continue to be the vigilant guardian of the rights of the ordinary citizen.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 2101
Location: Dallas area

PostPosted: Mon Nov 01, 2010 11:17 am    Post subject: Reply with quote

My personal philosophy is to use what works. :)

Oss4 (2003) works fine for my chipset (nvidia onboard) that doesn't mean it's for everyone.
If it's not working well for you, then retry alsa/PA. With each new release problems get fixed (most of the time :lol: )
_________________
Asus m5a99fx, FX 8320 - amd64-multilib, 3.9.1-zen, eudev
glibc-2.17, gcc-4.7.3-r1, xorg-server-1.15, lxde, nouveau, oss4
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Mon Nov 01, 2010 11:40 am    Post subject: Reply with quote

JohnLM wrote:
...Hadn't had the beep/noise bug yet, but a there's a new one - some extra harmonics over an actual sound...

I guess I failed to point out that "extra harmonics bug" pops up once in a while instead of being present constantly (just like missing sound)
And while I call them as three distinct bugs, I'm pretty sure they're different manifestations of the same bug.

Anon-E-moose wrote:
My personal philosophy is to use what works. :)

Oss4 (2003) works fine for my chipset (nvidia onboard) that doesn't mean it's for everyone.
If it's not working well for you, then retry alsa/PA. With each new release problems get fixed (most of the time :lol: )


I was actually thinking stacking Pulseaudio server on OSS driver. As long as Pulseaudio keeps an "sound output engine" busy (even with silence) with no pauses (or reconnects) it theoretically should do the trick as a dirty workaround of the problem.

btw Main reason of me dumping the ALSA was the "hell knows what kind" of sound level cap. To get equalization of sound without clipping I had to bring down pre-amp really low, even to point when only way to listen normally was to crank my speaker set to max. On contrast cranking speakers to max on XP (with mixer sliders at ~75%) would result in volume good for a club setting (in other words REALLY LOUD).
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Tue Nov 30, 2010 10:52 pm    Post subject: Reply with quote

*BUMP*

Still not solved, and PulseAudio doesn't work either. Seems like both OSS and system-wide support is dropped/disabled/masked in PulseAudio making it unsuitable to me.
JACK did work, but there was sound stuttering... a LOT. (JACK doesn't seem to play nice in non-realtime kernel with OSS)

Hmm, maybe I should write a "silent daemon". It could constantly feed /dev/dsp with silence, hopefully keeping vmix always busy (so it never disconnects from "sound engine").
Doesn't seem nice to write an apparently no-op program to run in background but it will have tiny footprint and CPU usage.
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Dec 01, 2010 1:00 am    Post subject: Re: OSS4 Audigy4 sound app reconnection problems Reply with quote

JohnLM wrote:
Creative SB Audigy4
I need to do whole mixing in software

You have a hardware-mixing soundcard. Software-mixing is not needed or desired, unless you want the software to be adding some sort of effect, e.g. an equalizer.
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Wed Dec 01, 2010 2:26 am    Post subject: Re: OSS4 Audigy4 sound app reconnection problems Reply with quote

PaulBredbury wrote:
You have a hardware-mixing soundcard. Software-mixing is not needed or desired, unless you want the software to be adding some sort of effect, e.g. an equalizer.

I'm aware of that, though OSS4 driver doesn't seem to play nice with it. (neither did ALSA btw)

Hmm, vmix is a software mixer isn't it?
Code:
SB Audigy4 main                   /dev/oss/oss_sblive0/pcm0  (device index 0)
    Legacy device /dev/dsp0
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      Engine      1: 0/SB Audigy4 main
                     Busy (IN/OUT) label 'VMIX'
      Engine      2: 1/SB Audigy4 main (vmix)
                     Available for use
      Engine      3: 2/SB Audigy4 main (vmix)
                     Busy (OUT) by PID 29140 / softs label 'softs'
      Engine      4: 3/SB Audigy4 main (vmix)
                     Available for use
      Engine      5: 4/SB Audigy4 main (vmix)
                     Available for use

I'm wondering what mode does it run? I usually assume software mixing.

Well, but this isn't really the topic anyway.

Among other things, I wrote the "silent daemon" program. Now just need to test it. I'll post code later, if it does any good!
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
JohnLM
n00b
n00b


Joined: 20 Apr 2009
Posts: 59
Location: LATVIA

PostPosted: Fri Dec 03, 2010 6:17 pm    Post subject: Reply with quote

[ ... ]

Hmm... I have gotten no feedback on this thing whatsoever...
Am I the only one having this bug?

Anyways here is my little program, which is a "hack" to workaround this bug
The code can be found on http://johnlm.hopto.org/files/silenced.tar.gz

What it's for:
The OSS4 bug with Audigy mentioned in this thread manifests itself as silence or garbled sound.
This often would happen on song change in music player because most implementations shuts down and recreates new "sound session" on audio device.
This in turn causes a short time nothing uses the audio device and the /dev/dsp is "suspended". The resuming it is what causes this bug.
*Why* it is caused by it is a whole other question... for which the answer is not known to me.

The idea:
Write a small daemon that just outputs silence. This would keep the device busy. No other audio is affected cause vmix mixes them with the silent stream.
Since device is never "suspended", the bug is prevented to manifest itself. (It's not fixed, that's why this is a workaround)

Implementation:
A small C program which opens /dev/dsp, writes some zeros to activate the device then use OSS-specific SNDCTL_DSP_SILENCE ioctl() directive.
This keeps the device active, but requires no further writing of zero bytes. The program then daemonises itself (if requested) and by pause() call is halted until a signal (SIGINT or SIGTERM) arrives.

You could use
Code:
cat /dev/zero > /dev/dsp
to same effect, but it writes zeros in an active loop using your CPU cycles.

Does it work?
It does for me! I have this in init script to be run on startup, and I've never had the bug again.
I'd like to hear your feedback if it works for you as well (or doesn't).
_________________
"I reject your reality and substitute my own" - A. Savage
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum