i-rinat / apulse

PulseAudio emulation for ALSA
MIT License
609 stars 35 forks source link

microphone doesn't work with skype #16

Closed powerman closed 10 years ago

powerman commented 10 years ago

Skype play sounds ok, but microphone doesn't work in skype at all. While skype test call (echo123) when it tries to play back my recording instead of 10 second (of silence) I get only about 0.5-1 sec between before/after "beeps", which gives me idea it may be related to wrong sample rate.

I've this issue with apulse 0.1.2, 0.1.3 and dev branch. My system is 64-bit Gentoo Linux, skype-4.3.0.37, sound card SB Audigy 2 ZS [SB0350]. Skype is 32-bit, so I'm running /usr/bin/i686-pc-linux-gnu-apulse skype. I've tried without ~/.asoundrc and with ~/.asoundrc from issue #14. I've also tried APULSE_CAPTURE_DEVICE=plughw:0,0 /usr/bin/i686-pc-linux-gnu-apulse skype.

Testing microphone with arecord/aplay and alsamixer show everything is fine (mic volume is ok, wav file recorded and played correctly). With pulseaudio microphone in skype also works ok.

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Audigy2 [SB Audigy 2 ZS [SB0350]], device 0: emu10k1 [ADC Capture/Standard PCM Playback]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Audigy2 [SB Audigy 2 ZS [SB0350]], device 1: emu10k1 mic [Mic Capture]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Audigy2 [SB Audigy 2 ZS [SB0350]], device 2: emu10k1 efx [Multichannel Capture/PT Playback]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Audigy2 [SB Audigy 2 ZS [SB0350]], device 4: p16v [p16v]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
i-rinat commented 10 years ago

If you launch Skype from terminal emulator, do you see any error messages?

powerman commented 10 years ago

No.

i-rinat commented 10 years ago

Then I have no idea what it is and how to fix it.

powerman commented 10 years ago

Any ideas about how to debug it? Increase debug level, use strace, etc.?

powerman commented 10 years ago

Also, I've previously used skype with pulseaudio, and used pavumeter to configure it, so maybe this happens because of some leftovers of pulseaudio configuration?

i-rinat commented 10 years ago

Any ideas about how to debug it?

Compiling debug version will turn on trace output, for almost every API call will be printed to stdout. (cmake -DCMAKE_BUILD_TYPE=Debug .., then make again.) I would trace return values from ALSA calls. Now if one of them fails, error is reported. It's still odd that no errors messages was produced.

Then, I would probably add logging to capture path to find out if any data is read from device.

so maybe this happens because of some leftovers of pulseaudio configuration?

No, I don't think so.

powerman commented 10 years ago

I've run /usr/bin/i686-pc-linux-gnu-apulse skype >apulse-debug.log 2>&1 (yesterday's dev version, I don't have ~/.asoundrc now), make skype test call, and exit skype. Please check log http://powerman.name/tmp/apulse-debug.log and let me know what I should try next.

lodgerz commented 10 years ago

try to edit ~/.asoundrc like that:

pcm.usb { type hw card Audigy2 }

pcm.!default { type asym playback.pcm { type plug slave.pcm "dmix" } capture.pcm { type plug slave.pcm "usb" } }

powerman commented 10 years ago

@lodgerz thanks, but it makes no difference, except with your .asoundrc skype was unable to open sound device while mplayer was runnning (without .asoundrc this issue doesn't exists).

lodgerz commented 10 years ago

show me the output of: $ cat /proc/asound/cards

powerman commented 10 years ago
$ cat /proc/asound/cards
 0 [Audigy2        ]: Audigy2 - SB Audigy 2 ZS [SB0350]
                      SB Audigy 2 ZS [SB0350] (rev.4, serial:0x20021102) at 0xc080, irq 19
lodgerz commented 10 years ago

try this: http://pastebin.com/ehT4YNUk or: http://pastebin.com/rgJq8TXm

powerman commented 10 years ago

With both configs microphone in skype still doesn't work. With second config I've also tried to run skype while mplayer was running - works ok - and also tried again to use arecord/aplay - microphone in arecord works ok:

$ LANG=C arecord -t wav -r 44100 -f S16_LE 1.wav
Recording WAVE '1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
^CAborted by signal Interrupt...
arecord: pcm_read:2031: read error: Interrupted system call
$ aplay 1.wav 
Playing WAVE '1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

I've also tried -r 48000 - works ok too. Not sure is this important but by default (without params) arecord use very bad quality (but it also works ok): "Unsigned 8 bit, Rate 8000 Hz, Mono".

powerman commented 10 years ago

BTW, looks like there is no difference in running skype or apulse skype because in Gentoo apulse's libs are installed into /usr/lib64/ and /usr/lib32/ and these paths are already in /etc/ld.so.conf.

powerman commented 10 years ago

Is there exists small tool similar to arecord but which use pulseaudio, to test microphone+apulse without skype?

i-rinat commented 10 years ago

Is there exists small tool similar to arecord but which use pulseaudio, to test microphone+apulse without skype?

avconv -f pulse -i default out.wav (or ffmpeg -f pulse -i default out.wav)

but they don't work now. Functions in libpulse-simple.so are not implemented, and if I use libpulse-simple.so from PulseAudio, nothing gets recorded. Didn't investigate that.

i-rinat commented 10 years ago

@powerman, try code from https://github.com/i-rinat/apulse/tree/dev

powerman commented 10 years ago

@i-rinat wow, it works! Thanks!

i-rinat commented 10 years ago

OK, pushed to master branch.