Page 1 of 1

Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 03:40
by askuhn
Running Ubuntu 11.10 64 bit, up to date and mostly default.

It doesn't matter if I'm playing version 83.0 from the Ubuntu PPA or building the latest development straight from git, I still experience stuttering and crackling sound in spring. The crackling is most noticeable during battle scenes when more sounds are playing at once. I've followed these instructions from the wiki:

Code: Select all

# install
sudo apt-get install alsoft-conf
# run
alsoft-conf
In the "backend" tab, keep only "ALSA" on the left column, then save. Done!

Side Note: ALSA is redirected to the PulseAudio layer when installed.
but it no longer resolves the issue for me. To note, it also does not matter if I use MT or not (MT actually doesn't suffer from this quite as much), have any other applications using sound, or whether or not pulse or alsa is selected in the left column of the OpenAL config.

While playing around with things, I discovered that if I change the only available back-end in the left column to something useless for spring, such as OSS, my map scrolling becomes much smoother and less jerky. This seems like a pretty big problem to me if just turning sound off can help so much.

And in GNOME's sound settings, the volume slider for spring flickers very quickly as if the entry is constantly turning on and off or something. I've attached some screenshots to clarify.

Image

So basically is there anything that can be done to have both properly functioning sound and smoother map scrolling? Thanks! :-)

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 03:44
by abma
you get this crackling with 5 ais?

uhm... tried with fewer ais? some ais heavily use cpu... did you try single-threaded spring? in some cases it performs better...

press alt+b ingame, to see what uses cpu.

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 03:55
by askuhn
abma wrote:you get this crackling with 5 ais?

uhm... tried with fewer ais? i guess your cpu is to slow...
Ummm...4 core AMD Phenom II X4 955 Processor at 3.2 GHz? I hope this isn't too slow... :?

And I would test with fewer ais, but I'm not even sure what those are or how to change that (sorry, noob here). :oops:

Also, should probably mention no problems with any other sound-using apps.

I'll check alt-b for the highest readings in my next game. The issue shows itself as soon as I load though, so I don't really think it's performance related (but I'm no developer).

edit...
Aaaand I should also clarify that the map scrolling isn't terrible when sound is on, but it is noticeably smoother when it's off.

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 04:00
by abma
Ummm...4 core AMD Phenom II X4 955 Processor at 3.2 GHz? I hope this isn't too slow... :?
for a normal game, no, for many ai's maybe... depends on map-size + unit count + ai.
I'll check alt-b for the highest readings in my next game. The issue shows itself as soon as I load though, so I don't really think it's performance related (but I'm no developer).
if no ai's are enabled, yes, true! some ai's have bugs causing it to use tons of cpu time.

can you try to disable all effects in alsoft-conf? this maybe can help, too.

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 04:07
by askuhn
abma wrote:can you try to disable all effects in alsoft-conf? this maybe can help, too.
I never tried this. This appears to totally solve the problem with the exact same setup that I was using for my OP! Map scrolling smooth too! Perhaps a bug in spring that causes these effects to make so much trouble? Tested using a /give all with ctrl+a and making everyone attack the same spot...thanks for the amazingly quick help! :mrgreen:

edit...
I never put it together that ais was the same as ai's. My bad. I was playing with a lot to intentionally stress things. I can go for hours on pretty big maps with little slowdown when running MT (as long as it doesn't deadlock at some point).

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 04:12
by abma
thanks for your nice report. i wish every user would do it like you.

i added it to the wiki, so it maybe helps others, too.

http://springrts.com/wiki/FAQ:trouble#I ... an_i_do.3F

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 04:19
by askuhn
You're welcome! Thanks again for the help! I love what you guys are doing here. Prime example just now...within 5 mins of a forum post, something is added to the wiki that might help anyone. Cool! :-)

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 04:30
by SpliFF
I'm also getting audio stuttering with Pulseaudio 1.1 on gentoo. Spring shows CPU at about 4% so I don't think the issue is that. Tried setting UseEFX = 0 but no change. Infolog attached. Will try some of these suggestions.

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 11:32
by abma
@spliff:

did you try with UseEFX=1 + disabled effects in alsoft-conf?

next step would maybe re-enable pulse...

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 12:13
by SpliFF
For some reason Gentoo doesn't seem to ship that tool so I created an ~/.alsoftrc by hand.

Code: Select all

[general]
format = AL_FORMAT_STEREO16
frequency = 44100
drivers = pulse,alsa
excludefx = eaxreverb,reverb,echo

[alsa]
device = pulse
mmap = true
Can't tell if I fixed it though because in the process I reset the alsa config and seem to have broken alsa entirely (I get no sound in spring and audacious reports "snd_pcm_open failed: Invalid argument." when using alsa output. SDL and pulseaudio backends work with other tools (paplay, audacious SDL) though.

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 14:20
by luckywaldo7
FWIW, I'm experiencing the same behavior. Seems to be reported on mantis previously: http://springrts.com/mantis/view.php?id=2368

Re: Ubuntu Sound Troubles... (even after some wiki suggestions)

Posted: 13 Nov 2011, 20:52
by askuhn
Going to jump back in here real quick to ask if it is possible to fix this directly in spring or "upstream" in some way... :?:

This issue seems to affect a lot of people using linux on at least a couple of distros no matter how the engine is installed.

I played another game after switching everything to the appropriate columns in that config tool and the performance gain was too significant to ignore. If there is anything that you guys can do to prevent this I think it would be great. Counting on the end user to go to the wiki, download tools, and modify configurations probably isn't for the best (many will probably just give up or leave rather than fix it). Just thinking out loud here...thanks :-)
SpliFF wrote:For some reason Gentoo doesn't seem to ship that tool so I created an ~/.alsoftrc by hand.
Here is what the config tool wrote to my ~/.alsoftrc on Ubuntu if it is helpful to you, SpliFF (attached).