Bug 129065

Summary: ALSA cs46xx driver - capture (recording) does not work
Product: [openSUSE] SUSE Linux 10.1 Reporter: Michael Stather <kontakt>
Component: SoundAssignee: Jaroslav Kysela <perex>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: tiwai
Version: Alpha 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Michael Stather 2005-10-18 15:54:48 UTC
Skype uses OSS emulation, and it´s not working correctly. I´ve a "SoundFusion
Audio Accelerator PCI" which works correctly with ALSA. But with Skype on the
first call I can hear but my partner doesn´t hear me, and when I hang up and
call someone again I get a message "problem with the audio device" until I restart.
Perhaps this is something with the ALSA-OSS emulation. I really want to help in
debugging, where should I start?
Comment 1 Takashi Iwai 2005-10-20 10:09:31 UTC
Try skype with aoss wrapper, at first, instead of kernel oss emulation.
Comment 2 Michael Stather 2005-10-20 14:48:27 UTC
I tested it and it doesn´t print the "problem with the audio device" any more, but I hear nothing, not even my partner.
I just tested that skype works in windows so it´s not a problem with my NAT.
Comment 3 Takashi Iwai 2005-10-25 13:40:53 UTC
The problem is Skype using OSS API, which requires the exclusive device access.
You cannot use any other things at the same time.

But, before debugging the oss stuff, please check whether you can record the signals properly.  Try "arecord -vv foo.wav".
If you get only silence, it's likely a problem of mixer configuration.
Start alsamixer, push [F4] to change to capture view mode, and choose "Capture", turn it on with space key, and raise the capture volume via up/down key.  Also, don't forget to choose the right capture source "Mic" with space key.
Comment 4 Michael Stather 2005-10-25 14:54:53 UTC
I tested this:
arecord -vv -d 1 foo.wav

for recording only 1 second of sound and all I get is:

Recording WAVE 'foo.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=U8)
Its setup is:
stream       : CAPTURE
access       : RW_INTERLEAVED
format       : U8
subformat    : STD
channels     : 1
rate         : 8000
exact rate   : 8000 (8000/1)
msbits       : 8
buffer_size  : 1365
period_size  : 85
period_time  : 10666
tick_time    : 0
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 85
xfer_align   : 85
start_threshold  : 1
stop_threshold   : 1365
silence_threshold: 0
silence_size : 0
boundary     : 178913280
Slave: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0*0,5 + 1*0,5
Its setup is:
stream       : CAPTURE
access       : MMAP_INTERLEAVED
format       : U8
subformat    : STD
channels     : 1
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 8
buffer_size  : 8192
period_size  : 512
period_time  : 10666
tick_time    : 0
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 512
xfer_align   : 512
start_threshold  : 6
stop_threshold   : 8192
silence_threshold: 0
silence_size : 0
boundary     : 1073741824
Slave: Direct Stream Mixing PCM

Its setup is:
stream       : CAPTURE
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 8192
period_size  : 512
period_time  : 10666
tick_time    : 0
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 512
xfer_align   : 512
start_threshold  : 6
stop_threshold   : 8192
silence_threshold: 0
silence_size : 0
boundary     : 1073741824
Hardware PCM card 0 'Sound Fusion CS46xx' device 0 subdevice 0

Its setup is:
stream       : CAPTURE
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 8192
period_size  : 512
period_time  : 10666
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 512
xfer_align   : 512
start_threshold  : 1
stop_threshold   : 1073741824
silence_threshold: 0
silence_size : 0
boundary     : 1073741824
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%
Max peak (85 samples): 00000 (0x0000) #                    0%

the program won´t terminate after 1 second but hang there forever until I kill it. The resulting file is not playable. Perhaps there´s something wrong with the recording support.
About OSS, I thought the ALSA OSS emulation makes me able to use OSS programs beside ALSA ones. Or is there also "either OSS or ALSA" at the same time?
Comment 5 Jaroslav Kysela 2005-11-01 11:39:41 UTC
Your mixer configuration is probably wrong. Select 'mic' source for capture (press space in alsamixer for example). Also you might enable MIC boost. Show us the output from 'amixer scontents' to get more hints what's wrong.
Comment 6 Michael Stather 2005-11-01 13:18:22 UTC
The mixer settings werre like you described. amixer still hangs and produces no valid wavfile. Here is the output of amixer:

michael@r098088:~> amixer scontents
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 63 [100%] [on]
  Front Right: Playback 63 [100%] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 0 [0%] [off]
  Front Right: Playback 0 [0%] [off]
Simple mixer control '3D Control - Center',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 0 [0%]
Simple mixer control '3D Control - Depth',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 0 [0%]
Simple mixer control '3D Control - Switch',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 24 [77%] [on]
  Front Right: Playback 24 [77%] [on]
Simple mixer control 'PCM Out Path & Mute',0
  Capabilities: enum
  Items: 'pre 3D' 'post 3D'
  Item0: 'pre 3D'
Simple mixer control 'Line',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 24 [77%] [on] Capture [off]
  Front Right: Playback 24 [77%] [on] Capture [off]
Simple mixer control 'CD',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 21 [68%] [on] Capture [off]
  Front Right: Playback 21 [68%] [on] Capture [off]
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Mono
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono: Playback 21 [68%] [on]
  Front Left: Capture [on]
  Front Right: Capture [on]
Simple mixer control 'Mic Boost (+20dB)',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Video',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Phone',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'IEC958 Input',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Output',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Aux',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 0 [0%] [on] Capture [off]
  Front Right: Playback 0 [0%] [on] Capture [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 15
  Front Left: Capture 0 [0%] [on]
  Front Right: Capture 0 [0%] [on]
Simple mixer control 'Mix',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Mix Mono',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'ADC',0
  Capabilities: volume cswitch cswitch-joined
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 32767
  Front Left: 32767 [100%] Capture [off]
  Front Right: 32767 [100%] Capture [off]
Simple mixer control 'Caller ID',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DAC',0
  Capabilities: volume cswitch cswitch-joined
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 32767
  Front Left: 32767 [100%] Capture [off]
  Front Right: 32767 [100%] Capture [off]
Simple mixer control 'Duplicate Front',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Off-hook',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Comment 7 Jaroslav Kysela 2005-11-01 13:39:44 UTC
Also unmute 'Mic Boost (+20dB)' switch. Could you try command 'aplay -Dplughw:0 -vv -d 1 foo.wav' ?
Comment 8 Jaroslav Kysela 2005-11-01 13:40:33 UTC
Sorry, the command should be 'arecord -Dplughw:0 -vv -d 1 foo.wav', of course.
Comment 9 Michael Stather 2005-11-02 00:17:44 UTC
I tried it and I can hear my voice through the headphones (even when I´m not recording) but the output is quiet. I´ve set the record source to mic and enabled the mic boost. asound doesn´t hang though but terminates after one second.
Comment 10 Jaroslav Kysela 2005-11-02 07:12:09 UTC
Also, raise the Capture Volume (amixer set Capture 75% on) and try again the last test.
Comment 11 Michael Stather 2005-11-02 08:17:11 UTC
I set it to 100% and still I can´t record something.
Comment 12 Jaroslav Kysela 2005-11-02 08:41:40 UTC
Please, attach output from 'amixer contents' after you set the mixer to all settings as I've described.
Comment 13 Michael Stather 2005-11-03 02:18:20 UTC
Here is the output. BTW I switched back to 10.0 final (the alpha didn´t work properly at all) but the problem is exact the same here.


numid=1,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=2,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=63,step=0
  : values=43,43
numid=3,iface=MIXER,name='Headphone Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=4,iface=MIXER,name='Headphone Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=63,step=0
  : values=43,43
numid=21,iface=MIXER,name='3D Control - Center'
  ; type=INTEGER,access=rw---,values=1,min=0,max=15,step=0
  : values=0
numid=22,iface=MIXER,name='3D Control - Depth'
  ; type=INTEGER,access=rw---,values=1,min=0,max=15,step=0
  : values=0
numid=20,iface=MIXER,name='3D Control - Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=19,iface=MIXER,name='PCM Out Path & Mute'
  ; type=ENUMERATED,access=rw---,values=1,items=2
  ; Item #0 'pre 3D'
  ; Item #1 'post 3D'
  : values=0
numid=14,iface=MIXER,name='PCM Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=15,iface=MIXER,name='PCM Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=31,step=0
  : values=20,20
numid=8,iface=MIXER,name='Line Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=9,iface=MIXER,name='Line Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=31,step=0
  : values=24,24
numid=10,iface=MIXER,name='CD Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=11,iface=MIXER,name='CD Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=31,step=0
  : values=20,20
numid=7,iface=MIXER,name='Mic Boost (+20dB)'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=5,iface=MIXER,name='Mic Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=6,iface=MIXER,name='Mic Playback Volume'
  ; type=INTEGER,access=rw---,values=1,min=0,max=31,step=0
  : values=31
numid=12,iface=MIXER,name='Aux Playback Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=13,iface=MIXER,name='Aux Playback Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=31,step=0
  : values=0,0
numid=26,iface=MIXER,name='ADC Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=32767,step=0
  : values=32767,32767
numid=27,iface=MIXER,name='ADC Capture Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=16,iface=MIXER,name='Capture Source'
  ; type=ENUMERATED,access=rw---,values=2,items=8
  ; Item #0 'Mic'
  ; Item #1 'CD'
  ; Item #2 'Video'
  ; Item #3 'Aux'
  ; Item #4 'Line'
  ; Item #5 'Mix'
  ; Item #6 'Mix Mono'
  ; Item #7 'Phone'
  : values=0,0
numid=17,iface=MIXER,name='Capture Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=on
numid=18,iface=MIXER,name='Capture Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=15,step=0
  : values=15,15
numid=30,iface=MIXER,name='IEC958 Input Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=29,iface=MIXER,name='IEC958 Output Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=24,iface=MIXER,name='Caller ID Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=28,iface=MIXER,name='DAC Capture Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=25,iface=MIXER,name='DAC Volume'
  ; type=INTEGER,access=rw---,values=2,min=0,max=32767,step=0
  : values=32767,32767
numid=34,iface=MIXER,name='Duplicate Front'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=23,iface=MIXER,name='Off-hook Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off
numid=31,iface=PCM,name='IEC958 Playback Default',device=2
  ; type=IEC958,access=rw---,values=1
  : values=?
numid=32,iface=PCM,name='IEC958 Playback Mask',device=2
  ; type=IEC958,access=r----,values=1
  : values=?
numid=33,iface=PCM,name='IEC958 Playback PCM Stream',device=2
  ; type=IEC958,access=rw---,values=1
  : values=?
Comment 14 Jaroslav Kysela 2005-11-03 07:00:12 UTC
numid=27,iface=MIXER,name='ADC Capture Switch'
  ; type=BOOLEAN,access=rw---,values=1
  : values=off


This should be probably on, too.
Comment 15 Michael Stather 2005-11-03 16:24:38 UTC
Recording works now but the quality is so bad that I can hardly recognize my voice in the recordings. Is this normal behaviour?
Comment 16 Jaroslav Kysela 2005-11-04 08:55:02 UTC
Try to play with all mixer settings related to capture (lower volume values for capture). If you set volumes too high, you'll get clipping.

This bug is related to:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=233
and also to:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=464
Comment 17 Jaroslav Kysela 2005-11-18 10:10:56 UTC
The original reported problem has been fixed (mixer settings).