You are not logged in.

#1 2012-07-21 00:46:43

dragos240
Member
Registered: 2009-05-23
Posts: 189

ALSA works, but only with one application at a time.

Hello,

Before I continue my post, I would like to say that I have read this section on the wiki:
https://wiki.archlinux.org/index.php/AL … ack_Issues

It asks the user to edit /etc/asound.conf (which does not exist) in order to comment out a few lines that will fix the problem. It's quite frustrating to need to close all audio using programs every time I want to play audio. I do not have pulseaudio installed. I tried installing OSS4 in order to fix the problem, but for some reason my kernel headers were not detected and I couldn't start the daemon. I would appreciate it if someone could reply to me and tell me what the problem could be.

Thanks,
Dragos

Offline

#2 2012-07-21 01:00:15

Terminator
Member
From: Belgium
Registered: 2012-05-07
Posts: 265

Re: ALSA works, but only with one application at a time.

Join the club smile.

The problem is that our sound cards don't support hardware mixing and for some reason, software mixing is not enabled automatically. I always take the easy solution of installing pulseaudio (and pulseaudio-alsa), but you can also solve it by editing /etc/asound.conf (or ~/.asoundrc). There are many examples on the wiki.

Offline

#3 2012-07-21 01:09:24

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ALSA works, but only with one application at a time.

dragos240 wrote:

what the problem could be.

Users who don't want to become devs and fix it wink

Be more specific. And read my ~/.asoundrc, which contains some common solutions.

Offline

#4 2012-07-21 12:25:32

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: ALSA works, but only with one application at a time.

I can confirm that simultaneous playing works by adding an asound.conf file with software mixing enabled.... with conditions.

Flash and Pianobar (console app):
1. Open flash firstly
2. Start playing flash video
3. Start pianobar
4. Begin playing song

It will work this way and display this error message:

ao_alsa WARNING: Unable to open surround playback.  Trying default device...

Now if I start pianobar firstly and begin to play a song, flash will not work and pianobar will steal the audio. I've had problems with pulseaudio in the past, so I'd rather stay away from it. The biggest problem with pulseaudio is the lack of a curses based mixer. That's a big problem when using something like DWM. I'd gladly switch to pulseaudio if I can manage to find some sort of working curses-based mixer for it.

Offline

#5 2012-07-21 12:41:28

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ALSA works, but only with one application at a time.

dragos240 wrote:

Unable to open surround playback

READ my ~/.asoundrc, as I said - it includes a dmix variant which works for e.g. surround51. ALSA's normal dmix is a bit crappy, and only works properly for stereo.

Offline

#6 2012-07-21 16:52:47

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: ALSA works, but only with one application at a time.

I'm using a part of your config right now. It doesn't appear to be working correctly, or perhaps I'm not looking at the right section?:

pcm.dmixed {
	type asym
	playback.pcm {
		# See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		type dmix
		ipc_key 5678293
		ipc_perm 0660
		ipc_gid audio
		# Don't put the rate here! Otherwise it resets the rate & channels set below, as shown by:  cat /proc/asound/card0/pcm0p/sub0/hw_params
		slave {
			# 2 for stereo, 6 for surround51
			channels 6
			pcm {
				# mplayer chooses S32_LE, but others usually S16_LE
				#format S32_LE
				format S16_LE

				# 44100 or 48000
				#rate 44100
				rate 48000

				type hw
				card 0
				device 0
				subdevice 0
			}

			# mplayer2 chooses 1024
			# period_size 512 with buffer_size 16384 stops crackling in xmame
			# 320 breaks flash - https://bbs.archlinux.org/viewtopic.php?id=129458
			#period_size 512
			period_size 1024
			# 2730 is chosen by "speaker-test"
			#period_size 512
			#period_time 20000
			#periods 8

			# 4096 makes Thief 1 in wine crackle.
			# mplayer2 chooses 8192
			#buffer_size 5460
			# 5460 (2730*2) is too small for mplayer2
			# If too large, use CONFIG_SND_HDA_PREALLOC_SIZE=2048
			buffer_size 8192
			#buffer_size 4096
			#buffer_time 682667  # 32768 samples at 48 kHz, in µs
			# 16384 seems best to stop crackling in Skype
			#buffer_size 16384

			# Seems good
			#period_size 256
			#periods 16
			#buffer_size 16384

			# Old config
			#buffer_size 10240
			#period_size 2048

			# Other options to maybe play with:
			#period_time 2
			#periods 2
		}

		bindings {
			0 0
			1 1
			2 2
			3 3
			4 4
			5 5
		}
	}
	capture.pcm "hw:0"
}

pcm.!surround51 {
	type plug
	slave.pcm "dmixed"
}

This is my asound.conf file. I'm sorry if I'm not finding the section you were talking about.

Thanks,
Dragos

Offline

#7 2012-07-21 22:10:00

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ALSA works, but only with one application at a time.

When using my setup, *ALL* output needs to go through "dmixed". You've missed out "default", which is the most common output (in stereo).

So you should also include what I have:

pcm.!default {
    type plug
    # Would need to always output to all 6 channels, so the dmixer actually work
s if e.g. 6-channel is attempted to be started, while 2-channel is playing.
    slave.pcm "dmixed"
}


pcm.!surround20 {
    type plug
    slave.pcm "dmixed"
}

pcm.!surround40 {
    type plug
    slave.pcm "dmixed"
}

Offline

Board footer

Powered by FluxBB