blink SIP client Pulseaudio setup

What is blink

Blink is a state of the art, easy to use SIP client.

Blink Screenshot (Contacts page)

Blink Screenshot (Contacts page)

What is the problem with blink?

Blink does not support pulseaudio by default. It only supports alsa (as per November 2017).

Not supporting alsa directly makes Blink setup in a Pulseaudio environment more challenging because when you select an alsa device it’s grabbed by blink.

Otherwise if pulseaudio grabs this same alsa device when you start Blink the same alsa device disappears from audio setup.

Let me show what was my setup before applying the workaround explained here.

 

Blink Input devices setup (Pre workaround)

Blink Input devices setup (Pre workaround)

The default «Playback/recording through the Pulseaudio sound server» device is a pulse plugin based alsa device which connects with pulseaudio. Unfortunately it’s bind to only one physical device at a time. I use it as both as an Input Device and an Output Device.

E.g. if pulseaudio has my headphones as default device then headphones will be used.

E.g. if pulseaudio has my usb speaker as default device then sound will come out from the usb speaker but no sound will be captured!

As an Alert Device I select HDA Intel PCH which it’s a native alsa device and that means that it’s not controlled by pulseaudio but from Blink directly.

How to identify  your ALSA devices

I later found out this section was not necessary but I write down this as extra documentation. You can skip to the How to identify your Pulseaudio devices section below.

With aplay

aplay -L | grep :CARD
hdmi:CARD=HDMI,DEV=0
dmix:CARD=HDMI,DEV=3
dsnoop:CARD=HDMI,DEV=3
hw:CARD=HDMI,DEV=3
plughw:CARD=HDMI,DEV=3
sysdefault:CARD=PCH
front:CARD=PCH,DEV=0
surround21:CARD=PCH,DEV=0
surround40:CARD=PCH,DEV=0
surround41:CARD=PCH,DEV=0
surround50:CARD=PCH,DEV=0
surround51:CARD=PCH,DEV=0
surround71:CARD=PCH,DEV=0
dmix:CARD=PCH,DEV=0
dsnoop:CARD=PCH,DEV=0
hw:CARD=PCH,DEV=0
plughw:CARD=PCH,DEV=0
sysdefault:CARD=Device
front:CARD=Device,DEV=0
surround21:CARD=Device,DEV=0
surround40:CARD=Device,DEV=0
surround41:CARD=Device,DEV=0
surround50:CARD=Device,DEV=0
surround51:CARD=Device,DEV=0
surround71:CARD=Device,DEV=0
iec958:CARD=Device,DEV=0
dmix:CARD=Device,DEV=0
dsnoop:CARD=Device,DEV=0
hw:CARD=Device,DEV=0
plughw:CARD=Device,DEV=0

With proc asound

cat /proc/asound/card*/id

HDMI
PCH
Device

Play your music in your cards

aplay -D hw:PCH your_favourite_sound.wav
aplay -D hdmi:HDMI your_favourite_sound.wav
aplay -D front:Device your_favourite_sound.wav

What I found out in my case

HDMI hdmi:HDMI (Screen – Not used by me)
PCH hw:PCH (USB Speakers)
Device front:Device (USB Headphones)

 

How to identify your Pulseaudio devices

Show different microphones

pacmd list-sources | grep -e device.string -e 'name:'

name:  alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo.monitor >
  device.string = "2"
name:  alsa_input.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-mono >
  device.string = "hw:2"
name:  alsa_output.pci-0000_00_1b.0.analog-stereo.monitor >
  device.string = "1"
name:  alsa_input.pci-0000_00_1b.0.analog-stereo >
  device.string = "front:1"
name:  alsa_output.pci-0000_00_03.0.hdmi-stereo.monitor >
  device.string = "0"

Show different outputs

pacmd list-sinks | grep -e 'name:' -e 'index'

* index: 0
  name:  alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo >
index: 1
  name:  alsa_output.pci-0000_00_1b.0.analog-stereo >
index: 2
  name:  alsa_output.pci-0000_00_03.0.hdmi-stereo >

.asoundrc workaround

This setups the different alsa devices which I have identified in the How to identify your Pulseaudio devices section with the specific pulse plugin which helps alsa and pulseaudio devices to coexist.

Now, unlike the default «Playback/recording through the Pulseaudio sound server» device now you will be able to select the specific device where you want your sound to be output.

Additionally thanks to the hint entries you can put more human names to the devices which alsa programs see.

My ~/.asoundrc contents are:

 pcm.pulse-my-usb-speaker {
     type pulse
     device "alsa_output.pci-0000_00_1b.0.analog-stereo"
     hint.description "My USB Speaker (Pulse)"
 }

  pcm.pulse-my-usb-headphones-out {
     type pulse
     device "alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo"
     hint.description "My USB Headphones OUT (Pulse)"
 }

   pcm.pulse-my-usb-headphones-mic {
     type pulse
     device "alsa_input.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-mono"
     hint.description "My USB Headphones MIC (Pulse)"
 }

How blink finally detects new devices

Once ~/.asoundrc is saved you need to quit Blink and restart it so that it recognises the new ‘alsa’ devices.

Here there is the Audio tab in the Blink Preferences dialog after selecting my ‘new’ devices.

 

Blink Audio Preferences - Input Devices - Post pulseaudio workaround

Blink Audio Preferences – Input Devices – Post pulseaudio workaround

The custom names are pretty obvious. Now I can select my USB speaker as the alert device and as input / output devices I use my headphones.

Alternative setups

Some ALSA purists might say that it would be better for pulseaudio to turn off the devices you want to use from Blink.

So that Blink uses those devices through native alsa where you probably have a better sound.

I don’t care too much about having an slightly better sound. What I want to is all my apps to use the different audio devices and not having to deal with an audio device disappearing in Blink because other programs (e.g. pulseaudio) used it first.

Final words

I have been trying this setup for about three days. The alert device does not disappear when used from another program. And sound quality is ok for me.

I recommend to try this setup (you can easily switch it off by renaming ~/.asoundrc,quitting Blink and starting Blink again ) if you are using Blink in a pulseaudio system and you struggle when dealing with several audio devices like me.

Etiquetas: , , , , , ,

Deja un comentario