Re: I think that the current state of ALSA is poor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 04, 2013 at 09:20:28AM +0100, Clemens Ladisch wrote:
> > On Tue, Dec 03, 2013 at 09:31:57AM +0100, Clemens Ladisch wrote:
> >> wempwer@xxxxxxxxx wrote:
> 
> > Before I am able to record any sound with arecord I need to go to
> > alsamixer and press space in Capture control so that L R Capture show
> > up.
> 
> Isn't that setting automatically saved?  When is it reset?

It's not saved automatically between reboots or ALSA restarts. On
Slackware ALSA is restarted by running `/etc/rc.d/rc.alsa restart'. I
looked at this script but didn't find anything that modifies Capture
controls level. I compared /var/lib/alsa/asound.state when L R Capture
controls were visible and when they were not and found that `value.0'
and `value.1' were set to false when L R Capture controls were
missing:

	control.7 {
		iface MIXER
		name 'Capture Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}

Maybe these values were set to 0 by default, or maybe I changed them
inadvertently in the paste. Now, after making them visible by pressing
Space key in Capture slider in alsamixer I did `alsactl store' and L R
Captures are always visible after ALSA restart.

Today, I was able to reproduce a situation with `arecord' not
recording any sound without giving a device name explicitly. Here is
the log you asked for:

$ arecord -v -f dat -d 3 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Linear conversion PCM (S32_LE)
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Soft volume PCM
Control: Digital Capture Volume
min_dB: -30
max_dB: 30
resolution: 121
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Direct Snoop PCM
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Hardware PCM card 0 'HDA ATI SB' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4611686018427387904
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

The above does not produce any sound. In contrary, this does:

$ arecord -v -f dat -d 3 test.wav -D hw:0,0
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Hardware PCM card 0 'HDA ATI SB' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 16384
  period_size  : 4096
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 4096
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

These outputs are verry different. The first is one bigger and
contains several sections, the other one has only one section named
`Hardware PCM card 0 'HDA ATI SB' device 0 subdevice 0' that the first
one alsa has but values of parameters such as stop_threshold or
avail_min are different between them.

I think this problem started to happen after trying to get linphone to
work. Linphone is a VOIP program, I like it because it can work in
command line. Unfortunately, it doesn't work too well here. I have the
exactly same problem as described here
http://lists.gnu.org/archive/html/linphone-users/2010-12/msg00008.html. I
also see plenty of these in linphone log:

ALSA lib pcm_dmix.c:1010:(snd_pcm_dmix_open) unable to open slave

I said in a previous e-mail, I need to set `OSS: /dev/dsp' as a
capture device in linphone settings to make the other side hear what I
say.

After that, if I want to hear the other side, I need to seet playback
device to OSS too. I end up with this:

[sound]
playback_dev_id=OSS: /dev/dsp
ringer_dev_id=ALSA: default device
capture_dev_id=OSS: /dev/dsp

What is more, when linphone starts it prints these:

ALSA lib conf.c:4630:(snd_config_expand) Unknown parameters 0
ALSA lib control.c:882:(snd_ctl_open_noupdate) Invalid CTL default:0
ALSA lib conf.c:4630:(snd_config_expand) Unknown parameters 1
ALSA lib control.c:882:(snd_ctl_open_noupdate) Invalid CTL default:1
ALSA lib pcm_dsnoop.c:612:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave

I think linphone is buggy. I don't use the newest version but a
changelog on their webisite doesn't mention any fixes in handling
audio devices. This problem does not go away by merely killing
linphone or restarting ALSA:

$ /etc/rc.d/rc.alsa  restart
/etc/rc.d/rc.alsa: line 64: modprobe: command not found
Loading ALSA mixer settings:  /usr/sbin/alsactl restore
Found hardware: "HDA-Intel" "IDT 92HD75B3X5"
"HDA:111d7603,103c363a,00100202" "0x103c" "0x363a"
Hardware is initialized using a generic method 

Restarting succeeds, but still no voice with `arecord' without a
device name. So, at the end of the day your guesses about some
programs changing some mixer controls can be correct.

And for my other problems:

1) about Bluetooth speakers not being able to be used by 2 programs at
the same time - I found out here
http://anarcat.koumbit.org/2013-02-04-why-i-don't-pulseaudio that:

`Unfortunately, while ALSA's dmix is designed to allow several
programs simuntaneous access to the audio device, it does so based on
one generally invalid assumption that is explicitly checked, see the
code. The assumption is: it talks directly to the hardware device that
supports MMAP. I.e., this makes mixed output from ALSA to a Bluetooth
headset impossible, because in ALSA speak bluetooth is not hardware.'

Bluetooth not being a hardware - it may be technically correct in
ALSA, but it's a bummer.

2) about moving PCM slider with no effect on machine with Intel HDA
PCH - it turned that Pulseadio gets in the way here. When I kill
pulseaudio with `pulseaudio --kill' and start it again with
`pulseaudio --start' after that, and start playing .mp3 file after
that I can use PCM to turn volume up and down and I can mute PCM. 

And, I talk about Linux popularity amongst casual users so much
because I have deliberately removed Windows from my parents' Acer
netbook and installed Linux for them and told them that it will be
better. It was taking Windows up to several minutes to start, it was
working slowly but a microphone and sound in general worked
correctly. Now, I am afraid to repeat this experiment on other
non-technical users.

-- 
<wempwer@xxxxxxxxx>

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user




[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux