I'm trying to set up A2DP+HFP profiles in an embedded board. Goal is to use pulseaudio 12.2, ofono 1.18, and bluez 5.41 in order to connect to a mobile phone and use A2DP, HFP profiles automatically, whenever necessary. I did lots and lots of things to update the versions and configure the daemons. Right now I can see that HFP profile is available when connected.
A2DP works perfectly and I am able to stream music from phone to embedded board. When I get a call, I can answer it with Bluetooth and it looks that HFP is the active profile whilst I'm in the call. The weird thing is that there is no audio from the embedded board (HDMI monitor connected to it).
The following will give you how it looks like. When I'm streaming music from phone via A2DP, I get following sources and sinks:
pactl list short sinks
0 alsa_output.hw_1_0 module-alsa-sink.c s16le 2ch 48000Hz SUSPENDED
1 alsa_output.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
2 alsa_output.platform-sound-hdmi.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz RUNNING
pactl list short sources
0 alsa_output.hw_1_0.monitor module-alsa-sink.c s16le 2ch 48000Hz SUSPENDED
1 alsa_output.platform-sound.analog-mono.monitor module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
2 alsa_input.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
3 alsa_output.platform-sound-hdmi.stereo-fallback.monitor module-alsa-card.c s16le 2ch 48000Hz IDLE
5 bluez_source.D8_5B_2A_5B_7B_E6.a2dp_source module-bluez5-device.c s16le 2ch 44100Hz RUNNING
Whenever I'm in the call (using HFP), I get following sources and sinks:
pactl list short sources
0 alsa_output.hw_1_0.monitor module-alsa-sink.c s16le 2ch 48000Hz SUSPENDED
1 alsa_output.platform-sound.analog-mono.monitor module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
2 alsa_input.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
3 alsa_output.platform-sound-hdmi.stereo-fallback.monitor module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
7 bluez_sink.D8_5B_2A_5B_7B_E6.headset_audio_gateway.monitor module-bluez5-device.c s16le 1ch 8000Hz IDLE
8 bluez_source.D8_5B_2A_5B_7B_E6.headset_audio_gateway module-bluez5-device.c s16le 1ch 8000Hz RUNNING
pactl list short sinks
0 alsa_output.hw_1_0 module-alsa-sink.c s16le 2ch 48000Hz SUSPENDED
1 alsa_output.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
2 alsa_output.platform-sound-hdmi.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
3 bluez_sink.D8_5B_2A_5B_7B_E6.headset_audio_gateway module-bluez5-device.c s16le 1ch 8000Hz RUNNING
This is quite weird since sink changes from my HDMI monitor to the bluetooth device itself whenever I am in the call. Please find my /etc/pulse/default.pa below:
.fail
### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties
### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available
### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
load-module module-alsa-sink device=hw:1,0
#load-module module-alsa-source
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif
### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy ag=true auto_switch=2
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover headset=auto
.endif
### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish
### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv
### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor
### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif
### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore
### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams
### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink
### Honour intended role device property
load-module module-intended-roles
### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle
### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif
### Enable positioned event sounds
load-module module-position-event-sounds
### Cork music/video streams when a phone stream is active
load-module module-role-cork
### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply
load-module module-switch-on-connect
### Make some devices default
# Make HDMI default
set-default-sink 0
#set-default-source input
The following is my .asoundrc ALSA configuration (HDMI device by default):
pcm.!default {
type hw
card 1
device 0
}
Any help is greately appreciated. Thanks in advance.
Try (before connecting call)
pactl set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
pactl set-default-source alsa_output.platform-sound.analog-mono.monitor
If issue is not solved yet, Please share what you get from
pacmd list-sinks
pacmd list-sources
pacmd list-sink-inputs
pacmd list-source-outputs
Related
I am trying to record what my device is currently playing using arecord (it is playing audio via mplayer).
I've done everything I have been able to read so far such as checking under which user mplayer is running, setting the user as per the command below, but it only ever records silence.
This is the list of users where my user is ID 1000:
user:x:1000:1000:,,,:/home/user:/bin/bash
This shows that what I am trying to record is running by that user:
user 1217 2.3 1.3 131704 25524 ? SL 09:11 12:15 /usr/bin/mplayer http://example.com/stream
This is the command I am running:
XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/arecord -d 1 /home/user/rec.waw
The command will output:
Recording WAVE '/home/user/rec.waw' : Unsigned 8 bit, Rate 8000 Hz, Mono
And it writes the file, but the content is silent.
I have tried specifying --device but not sure how to specify it from the list of devices below (I tried --device=CARD=Headphones and --device=hw:CARD=Headphones but I get errors.
This is the output of arecord -L
user#device:~ $arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
Playback/recording through the PulseAudio sound server
output
usbstream:CARD=b1
bcm2835 HDMI 1
USB Stream Output
usbstream:CARD=Headphones
bcm2835 Headphones
USB Stream Output
Any help would be appreciated.
So the question is,
How can I set the default source?
How can I list the current default source?
Details
I have 4 sound input sources on my linux device. Here is the result of pactl list sources:
1 alsa_input.pci-0000_00_1b.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
2 alsa_input.usb-Generic_Rmoncam_HD_720P_200901010001-02.analog-stereo module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
3 alsa_input.usb-Generic_Rmoncam_HD_720P_200901010001-02.analog-stereo.2 module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
5 alsa_output.pci-0000_00_1b.0.hdmi-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
I tried to set the source 1 alsa_input.pci-0000_00_1b.0.analog-stereo as my default source by several ways:
1.change /etc/pulse/client.conf, add following lines:
default-sink = alsa_output.pci-0000_00_1b.0.hdmi-stereo
default-source = alsa_input.pci-0000_00_1b.0.analog-stereo
2.change /etc/pulse/default.pa, add following lines:
### Make some devices default
set-default-source alsa_input.pci-0000_00_1b.0.analog-stereo
After configuration complete, I tried pulseaudio -D and reboot the device, but the config take no effect. I don't know how to list the current default source and sink, so I use following command to verify:
$> pactl load-module module-loopback latency_msec=500
$> pactl list sources short | grep RUNNING
3 alsa_input.usb-Generic_Rmoncam_HD_720P_200901010001-02.analog-stereo.2 module-alsa-card.c s16le 2ch 48000Hz RUNNING
The pactl still use my usb camera's microphone as its default source.
System Info
Linux kernel:
Linux D2-A109 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
PulseAudio version:
$> pulseaudio --version
11.1
Any advice is welcome!
Finally..I find it's just caused by the microphone "unplugged"... And the way to set the default source is correct.
And I find the answer of Q2."How can I list the current default source?":
$> pacmd list-sources | grep -e 'index:' -e device.string -e 'name:' -e 'available'
* index: 1
name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
device.string = "front:0"
analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: no)
analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: yes)
analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
index: 2
name: <alsa_input.usb-Generic_Rmoncam_HD_720P_200901010001-02.analog-stereo>
device.string = "plug:front:1"
analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
index: 3
name: <alsa_input.usb-Generic_Rmoncam_HD_720P_200901010001-02.analog-stereo.2>
device.string = "plug:front:2"
analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
index: 7
name: <alsa_output.pci-0000_00_1b.0.hdmi-stereo.monitor>
device.string = "0"
Corresponding to PulseAudio wiki, The * in front of the index indicates the current default input.
To avoid someone being stupit as me, we can determine if the microphone(source) is plugged, by checking 'available' in the printing result of sources.
How can I list the current default source?
With pulseaudio 15.0 you can now just run pactl get-default-source to get the device string without resorting to running sed/awk/grep etc on the output.
i am totally new to pulse audio and alsa. the situation is this:
i have mpd compiled for alsa. this is embedded system and pulse audio plugin for mpd is not available.
when i DO NOT start pulse audio, mpd runs fine using alsa
as soon as i start pulse audio [ which is needed by bluetooth audio unfortunately ] , mpd / alsa stops working .
seems like, somehow pulse audio is grabbing the device and not letting it go . even after i stop pulse audio daemon .
Trying to run mpd afterwards gives me:
root#FINGI_GCC:~# mpc play
http://relay3.slayradio.org:8000/
[paused] #1/1 0:00/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
ERROR: problems opening audio device
So i was wondering how to reset pulse audio ? need to keep running pulse audio,mpd,alsa all on the same device..but not all at the same time.
Any suggestion on this?
Assuming this audio device in in /dev/snd/, you could try to see which process is holding it with:
lsof /dev/snd/*
Then you could try to kill this process.
For instance when I'm running alsamixer, I get:
$ lsof /dev/snd/*
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
...
alsamixer 7152 emilien 3u CHR 116,5 0t0 10154 /dev/snd/controlC0
...
I installed raspbian using noobs on a fresh SD card.
I have XBian with XBMC in another SD and it works so HW is Ok.
The problem is that I cannot play stereo, thus I cannot play through HDMI, and I cannot play from ZynAddSubFX that is a midi sampler and my final target for this project.
This is the result from amixer:
Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback -1900 [78%] [-19.00dB] [on]
the Mono playback is weird for me and the Limites of the playback are also suspicious.
If I install pulseaudio then amixer takes A LOT OF TIME to respond BUT this is the result:
amixer
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 27111 [41%] [on]
Front Right: Playback 27111 [41%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined penum
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 65536 [100%] [on]
Front Right: Capture 65536 [100%] [on]
Much more convenient and expected.
The problem is that I DON'T want to use pulseaudio and, actually, I think ZynAddSubFX is not compatible with pulseaudio.
For sure I've googled around a lot but there is no clear solution. I found out the trick for forcing analog output (amixer cset numId=3 1) it works in terms that I do hear something but the main problem is there .. only mono.
this is the output for lsmod:
lsmod
Module Size Used by
snd_bcm2835 16165 0
snd_soc_bcm2708_i2s 5474 0
regmap_mmio 2806 1 snd_soc_bcm2708_i2s
snd_soc_core 131268 1 snd_soc_bcm2708_i2s
regmap_spi 1897 1 snd_soc_core
snd_pcm 81593 2 snd_bcm2835,snd_soc_core
snd_page_alloc 5156 1 snd_pcm
regmap_i2c 1645 1 snd_soc_core
snd_compress 8076 1 snd_soc_core
snd_seq 53769 0
snd_timer 20133 2 snd_pcm,snd_seq
snd_seq_device 6473 1 snd_seq
leds_gpio 2059 0
led_class 3688 1 leds_gpio
snd 61291 7
snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
Any clue ?? Any other output that might be interesting ??
I'm using Debian 4.4.6-1+rpi14 (2016-05-05) and have a very similar problem. The sound is mono only when using ALSA. The the sound is not continuous and the quality is poor. If I use omxplayer the output is stereo and the sound quality is good. I've found if I use mplayer -ao alsa:device=hw=0,0 then the sound quality is as good as using omxplayer and it is stereo! Somehow ALSA is not functioning normally if the default device hw:0.0 is not given as an parameter. So the solution for pulseaudio is to add the the device=hw:0,0 option.
pactl load-module module-alsa-sink device="hw:0,0"
pactl set-default-sink alsa_output.hw_0_0
Now pulseaudio shows stereo output and the sound quality is as good as omxplayer.
I finally "solved" by buying a 1.34€ USB sound card. I dont really thing that this count as a solution but .. I needed the mic line anyhow
Late answer but I can still relevant at this date: I faced the same problem (mono sound through hdmi output) with the ubuntu distro for raspberry pi, but everything works fine when using the raspbian distro from raspberry web site.
I'm running Ubuntu 12.04 studio on a HP Pavilion dm1 4200sg netbook. It's pretty much a fresh install. I try to start jackd server by running
jackd -R -d alsa
and it fails with output:
JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Cannot initialize driver
JackServer::Open() failed with -1
Failed to open server
Running aplay -l gives the following output:
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: STAC92xx Analog [STAC92xx Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
I find that by running
jackd -R -d alsa -d hw:1
jackd starts successfully. I would like to configure my machine so that hw:1 is the default option (i.e. to make the original 'jackd -R -d alsa' command work). Can anyone help me to do this?
I've tried editing ~/.asoundrc to be
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
but this doesn't seem to work. I'm well out of my comfort zone here and any help would be appreciated. Thanks!
I've found a workaround. It doesn't configure JACK server but alters the order the sound cards are listed.
I first entered into the terminal:
sudo lshw -c multimedia
which showed which modules the two cards were using. They were both using 'snd-hda-intel'.
I then entered into the terminal:
cat /proc/asound/card0/id
cat /proc/asound/card1/id
Which gave ids 'Generic' and 'SB' for cards 0 and 1, respectively.
I then added the following two lines to the end of the file '/etc/modprobe.d/alsa-base.conf'
options snd-hda-intel id=SB index=0
options snd-hda-intel id=Generic index=1
After rebooting the machine, card 'SB' was loaded into position 0 and
jackd -R -d alsa
correctly started.
First, in a terminal window, run this command:
cat /proc/asound/cards.
You’ll see output a bit like this:
0 [SB ]: HDA-Intel - HDA ATI SB
HDA ATI SB at 0xfcef8000 irq 16
1 [DSP ]: H-DSP - Hammerfall DSP
RME Hammerfall DSP + Digiface at 0xfcff0000, irq 20
2 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xfe57c000 irq 32
The “name” of each soundcard is in square brackets.
With this information, you can now refer to a particular device as, for example hw:DSP now you can execute the command:
jackd -d alsa -d hw:DSP
And thats all, taken from:
http://www.jackaudio.org/faq/device_naming.html
EDIT: added code tags
First, open up alsa-base.conf:
sudo gedit /etc/modprobe.d/alsa-base.conf
Find the following line:
"options snd-hda-intel index=-2"
And change it to:
"#options snd-hda-intel index=-2"
Restart your machine and try again. You may have to set the proper sound device (alsa) for your programs.