【鼎革‧革鼎】︰ Raspbian Stretch 《六之 G‧H 》

假使當我們選擇藍牙喇叭作為系統預設時︰

pi@raspberrypi:~ more ~/.asoundrc  pcm.!default { 	type plug 	slave.pcm { 		type bluealsa 		device "00:02:5B:00:47:4E" 		profile "a2dp" 	} }  ctl.!default { 	type bluealsa } </pre>    <span style="color: #666699;">Sonic π 是否會使用它耶?</span>  <img class="alignnone size-full wp-image-78559" src="http://www.freesandal.org/wp-content/uploads/SonicPi-a2dp.png" alt="" width="1920" height="1080" />     <span style="color: #666699;">考之於啟動之 jackd 參數︰</span> <pre class="lang:default decode:true">pi@raspberrypi:~ ps ax | grep jack
 1952 ?        SLsl   0:01 jackd -R -p 32 -d alsa -d hw:0 -n 3 -p 2048 -o2 -r 44100
 2114 pts/0    S+     0:00 grep --color=auto jack

 

故知其未用乎??如是

Configuration & Usage

The main component of the BlueALSA is a program called bluealsa. It should be run as a root during system startup (root privileges are not required per se, the only requirement is a write access to /var/run/bluealsa). This program acts as a proxy between Bluez and ALSA.

In order to stream audio to the e.g. Bluetooth headset, firstly one has to connect the device. The most straightforward method is to use Bluez CLI utility called bluetoothctl. When the device is connected one can use the bluealsa virtual PCM device as follows:

aplay -D bluealsa:HCI=hci0,DEV=XX:XX:XX:XX:XX:XX,PROFILE=a2dp Bourree_in_E_minor.wav</code></pre>    <span style="color: #666699;">所說的 bluealsa 到底是什麼東東也!分明</span>  <span style="color: #ff9900;">aplay -D bluealsa:HCI=hci0,DEV=00:02:5B:00:47:4E,PROFILE=a2dp /usr/share/sounds/alsa/Noise.wav</span>  <span style="color: #ff9900;">aplay -D default /usr/share/sounds/alsa/Noise.wav</span>     <span style="color: #666699;">都很 OK 哩,而且果有此 default 裝置呦!!</span> <pre class="lang:default decode:true ">pi@raspberrypi:~ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
playback
dmixed
ac108
default
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
pi@raspberrypi:~ </pre>    <span style="color: #666699;">難到遇着虛擬裝置啊?★</span> <h1><span style="color: #ff9900;"><a style="color: #ff9900;" href="http://nairobi-embedded.org/alsa_pcm_plugins_capture.html">Basic Virtual PCM Devices for Playback/Capture, <i>ALSA</i></a></span></h1> <div class="well small">  <span style="color: #808080;"><b>Author:</b> <a class="url fn" style="color: #808080;" href="http://nairobi-embedded.org/author/mugabi-siro.html"><i>Mugabi Siro</i></a></span>  <span style="color: #808080;"><b>Category:</b><a style="color: #808080;" href="http://nairobi-embedded.org/category/alsacots-infrastructure-for-dsp.html"> ALSA/COTS Infrastructure for DSP</a></span>  <span style="color: #808080;"><b>Summary:</b></span>  <span style="color: #808080;">Brief descriptions of a few ALSA virtual PCM devices. Note that the complete information about these devices and PCM plugins is quite extensive and can be found in the links included in the <em>Resources</em> section. This entry will only describe a few of the standard/common virtual PCM devices. It was originally written for audio capture purposes, but all the virtual PCM devices described -- with the exception of <code>dsnoop</code> -- can also be used for playback.</span>  <span style="color: #808080;"><i>Tags: <a style="color: #808080;" href="http://nairobi-embedded.org/tag/linux.html">linux </a><a style="color: #808080;" href="http://nairobi-embedded.org/tag/alsa.html">alsa </a></i></span>  </div> <div class="well small"></div> <div> <span style="color: #666699;">一時狐疑,將如何判斷的呀!☆</span></div> <pre class="lang:default decode:true ">pi@raspberrypi:~ arecord [-D default] foo.wav -vv
ALSA lib bluealsa-pcm.c:660:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA transport: 沒有此一裝置
arecord: main:788: audio open error: 沒有此一裝置
pi@raspberrypi:~ $