<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jchidley</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jchidley"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Jchidley"/>
	<updated>2026-05-09T17:59:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20028</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20028"/>
		<updated>2021-08-04T20:49:52Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* bluez-alsa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. You&#039;ll need to comment out some lines (by adding &amp;quot;#&amp;quot; at the beginning):&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/Arkq/bluez-alsa Bluetooth Audio ALSA Backend]&lt;br /&gt;
[https://github.com/Arkq/bluez-alsa/tree/master/doc bluez-alsa doc]&lt;br /&gt;
[https://manpages.debian.org/unstable/bluez-alsa-utils/bluealsa.8.en.html man bluealsa]&lt;br /&gt;
[https://manpages.debian.org/unstable/bluez-alsa-utils/bluealsa-aplay.1.en.html man bluealsa-aplay]&lt;br /&gt;
[https://panther.kapsi.fi/posts/2018-11-17_linux_bluetooth_audio Bluetooth audio in Linux: ALSA and LDAC]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20027</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20027"/>
		<updated>2021-08-04T20:46:25Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* bluez-alsa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. You&#039;ll need to comment out some lines (by adding &amp;quot;#&amp;quot; at the beginning):&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/Arkq/bluez-alsa Bluetooth Audio ALSA Backend]&lt;br /&gt;
[https://github.com/Arkq/bluez-alsa/tree/master/doc bluez-alsa doc]&lt;br /&gt;
[https://manpages.debian.org/unstable/bluez-alsa-utils/bluealsa.8.en.html man bluealsa]&lt;br /&gt;
[https://manpages.debian.org/unstable/bluez-alsa-utils/bluealsa-aplay.1.en.html man bluealsa-aplay]&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20026</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20026"/>
		<updated>2021-08-04T20:17:01Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. You&#039;ll need to comment out some lines (by adding &amp;quot;#&amp;quot; at the beginning):&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20025</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20025"/>
		<updated>2021-08-04T20:15:49Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20024</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20024"/>
		<updated>2021-08-04T20:14:31Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20023</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20023"/>
		<updated>2021-08-04T20:13:46Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
  &lt;br /&gt;
      def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background, and pair your devices:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20022</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20022"/>
		<updated>2021-08-04T20:12:19Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Manual device pairing&lt;br /&gt;
&lt;br /&gt;
  bluetoothctl&lt;br /&gt;
&lt;br /&gt;
  [bluetooth]# discoverable on&lt;br /&gt;
  [agent] Confirm passkey 627133 (yes/no): yes&lt;br /&gt;
  [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): yes&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
  vi /usr/bin/bluez-simple-agent&lt;br /&gt;
&lt;br /&gt;
  #import bluezutils&lt;br /&gt;
  &lt;br /&gt;
      def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        def RequestConfirmation(self, device, passkey):&lt;br /&gt;
                #print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey))&lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)&lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):&lt;br /&gt;
                set_trusted(device)        &lt;br /&gt;
                return        &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
  lbu include /usr/bin/bluez-simple-agent&lt;br /&gt;
  lbu commit&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20021</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20021"/>
		<updated>2021-08-04T19:49:56Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Article Completion=&lt;br /&gt;
# Test everything&lt;br /&gt;
# Turn every background task into a service&lt;br /&gt;
# More investigation on Bluetooth pairing&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20020</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20020"/>
		<updated>2021-08-04T19:48:04Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* bluez-alsa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
At the time of writing this article, bluez-alsa is only found in the community repositories, so you need to edit your repository list:&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the &amp;quot;#&amp;quot; from the community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20019</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20019"/>
		<updated>2021-08-04T19:42:24Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker   # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C                 # Adding audio playback and recording to this Bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0       # Always discoverable&lt;br /&gt;
  AlwaysPairable = true         # Always pairable&lt;br /&gt;
  PairableTimeout = 0           # no time limit&lt;br /&gt;
  AutoEnable=true               # starts Bluetooth when Linux &#039;sees&#039; the Bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that Bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20018</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20018"/>
		<updated>2021-08-04T19:39:46Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Getting the Speaker(s) Working */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
To get the best results, you&#039;ll need an dedicated audio add-on board and matching speakers. Higher end passive speakers need a proper amplifier (e.g. HiFiBerry Amp2 or IQaudIO IQaudIO DigiAMP+).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve used the whole range of IQaudio audio boards with different speakers and headphones. I&#039;d also recommend a dedicated USB Bluetooth dongle (don&#039;t get the cheapest versions of these). It is possible to test by using the on-board Bluetooth and the on-board audio with headphones but the audio quality, owing to dropped packets, isn&#039;t great.&lt;br /&gt;
&lt;br /&gt;
Once the speakers and audio card and all connected to the Raspberry Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C # Adding audio playback and recording to this bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0 # Always discoverable&lt;br /&gt;
  AlwaysPairable = true # Always pairable&lt;br /&gt;
  PairableTimeout = 0 # no timeime&lt;br /&gt;
  AutoEnable=true # will start when Linux &#039;sees&#039; the bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20017</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20017"/>
		<updated>2021-08-04T19:31:30Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Before You Start */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* Sound card and speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C # Adding audio playback and recording to this bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0 # Always discoverable&lt;br /&gt;
  AlwaysPairable = true # Always pairable&lt;br /&gt;
  PairableTimeout = 0 # no timeime&lt;br /&gt;
  AutoEnable=true # will start when Linux &#039;sees&#039; the bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20016</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20016"/>
		<updated>2021-08-04T19:30:26Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C # Adding audio playback and recording to this bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0 # Always discoverable&lt;br /&gt;
  AlwaysPairable = true # Always pairable&lt;br /&gt;
  PairableTimeout = 0 # no timeime&lt;br /&gt;
  AutoEnable=true # will start when Linux &#039;sees&#039; the bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20015</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20015"/>
		<updated>2021-08-04T19:29:48Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C # Adding audio playback and recording to this bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0 # Always discoverable&lt;br /&gt;
  AlwaysPairable = true # Always pairable&lt;br /&gt;
  PairableTimeout = 0 # no timeime&lt;br /&gt;
  AutoEnable=true # will start when Linux &#039;sees&#039; the bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Device pairing:&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20014</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20014"/>
		<updated>2021-08-04T19:28:35Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = Pi-Bluetooth-Speaker # This is what you&#039;ll see when connecting &lt;br /&gt;
  Class = 0x41C # Adding audio playback and recording to this bluetooth device&lt;br /&gt;
  DiscoverableTimeout = 0 # Always discoverable&lt;br /&gt;
  AlwaysPairable = true # Always pairable&lt;br /&gt;
  PairableTimeout = 0 # no timeime&lt;br /&gt;
  AutoEnable=true # will start when Linux &#039;sees&#039; the bluetooth device at boot&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20013</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20013"/>
		<updated>2021-08-04T19:24:30Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
Ensure that bluetooth is started at boot:&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
&lt;br /&gt;
Bluetooth&#039;s state, including paired devices, in held in `/var/lib/bluetooth` so you&#039;ll need to add this to `lbu` state:&lt;br /&gt;
&lt;br /&gt;
  lbu include /var/lib/bluetooth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
  AutoEnable=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20012</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20012"/>
		<updated>2021-08-04T16:02:22Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* How To Build a Raspberry Pi Bluetooth Speaker */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written. Currently it is full of bugs but will provide some useful pointers.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
  AutoEnable=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20011</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20011"/>
		<updated>2021-08-04T16:01:48Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
  AutoEnable=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Getting this to work currently involves running the bluez-simple-agent after having edited it to always return sucessful. Note the comments below:&lt;br /&gt;
&lt;br /&gt;
        def RequestPinCode(self, device):                                      &lt;br /&gt;
                print(&amp;quot;RequestPinCode (%s)&amp;quot; % (device))                       &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return #ask(&amp;quot;Enter PIN Code: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          def RequestConfirmation(self, device, passkey):                      &lt;br /&gt;
                print(&amp;quot;RequestConfirmation (%s, %06d)&amp;quot; % (device, passkey)) &lt;br /&gt;
                #confirm = ask(&amp;quot;Confirm passkey (yes/no): &amp;quot;)                &lt;br /&gt;
                #if (confirm == &amp;quot;yes&amp;quot;):                                      &lt;br /&gt;
                set_trusted(device)                                          &lt;br /&gt;
                return                                                       &lt;br /&gt;
                #raise Rejected(&amp;quot;Passkey doesn&#039;t match&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
And then running the revised agent in the background:&lt;br /&gt;
&lt;br /&gt;
  bluez-simple-agent &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Notes: [https://www.kynetics.com/docs/2018/pairing_agents_bluez/ Pairing Agents in BlueZ stack]&lt;br /&gt;
[https://stackoverflow.com/questions/59214524/since-bluez-5-48-iphones-require-pairing-when-connecting-on-a-ble-gap-periphera Since Bluez 5.48, iPhones require pairing when connecting on a BLE GAP peripheral, why?]&lt;br /&gt;
[https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c Headless A2DP Audio Streaming on Raspbian Stretch ]&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20010</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20010"/>
		<updated>2021-08-04T15:04:17Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
  AutoEnable=true&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20009</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20009"/>
		<updated>2021-08-04T13:27:39Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* bluez-alsa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
&lt;br /&gt;
  vi /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
remove the comment from your community repository, mine is:&lt;br /&gt;
&lt;br /&gt;
  http://uk.alpinelinux.org/alpine/v3.14/community&lt;br /&gt;
&lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20008</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20008"/>
		<updated>2021-08-04T13:25:39Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
Changes to /etc/bluetooth/main.conf&lt;br /&gt;
&lt;br /&gt;
  Name = BlueZ-ALSA-test&lt;br /&gt;
  Class = 0x41C &lt;br /&gt;
  DiscoverableTimeout = 0&lt;br /&gt;
  AlwaysPairable = true&lt;br /&gt;
  PairableTimeout = 0&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
  &lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20007</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20007"/>
		<updated>2021-08-04T13:22:00Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
=bluez-alsa=&lt;br /&gt;
  &lt;br /&gt;
This is the final stretch.  We&#039;ve got bluetooth working and now we want to link bluetooth to the speakers&lt;br /&gt;
&lt;br /&gt;
  apk add bluez-alsa&lt;br /&gt;
  bluealsa -p a2dp-source -p a2dp-sink &amp;amp;&lt;br /&gt;
  bluealsa-aplay &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20006</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20006"/>
		<updated>2021-08-04T12:37:58Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; and enable bluetooth. We&#039;re using `sed`, where &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 115200/ttyAMA0         root:tty 660 @btattach -B \/dev\/$MDEV -P bcm -S 3000000/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
Note: the last command uncomments the &#039;&#039;btattach&#039;&#039; command and changes it to work with the Pi 4. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  apk add python3 py3-dbus py3-gobject3&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20005</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20005"/>
		<updated>2021-08-04T11:56:57Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Bluetooth */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
edit &#039;&#039;/etc/mdev.conf&#039;&#039; using `sed`. &#039;&#039;&#039;s/#rpi bluetooth/rpi bluetooth/&#039;&#039;&#039; means replace &#039;&#039;&#039;#rpi bluetooth&#039;&#039;&#039; with &#039;&#039;&#039;rpi bluetooth&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
  sed -i &#039;s/#rpi bluetooth/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
  sed -i &#039;s/#btattach -B \/dev\/ttyAMA0 -P bcm -S 115200 -N &amp;amp;/btattach -B \/dev\/ttyAMA0 -P bcm -S 3000000 &amp;amp;/rpi bluetooth/&#039; /etc/mdev.conf&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20004</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20004"/>
		<updated>2021-08-04T10:56:27Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Bluetooth=&lt;br /&gt;
&lt;br /&gt;
I used [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth Raspberry Pi 3 - Setting Up Bluetooth] as a reference with some slight modifications as I am using a Pi 4.&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi 4&lt;br /&gt;
&lt;br /&gt;
  apk add bluez&lt;br /&gt;
  btattach -B /dev/ttyAMA0 -P bcm -S 3000000 &amp;amp;&lt;br /&gt;
  # btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &amp;amp; # Pi 3 - not tested by me&lt;br /&gt;
  rc-service bluetooth start&lt;br /&gt;
&lt;br /&gt;
  rc-update add bluetooth&lt;br /&gt;
  lbu commit &amp;amp;&amp;amp; reboot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20003</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20003"/>
		<updated>2021-08-04T10:22:36Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Getting the Speaker(s) Working */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
Before you play anything from your speakers, I advise you to lower the volume first.&lt;br /&gt;
&lt;br /&gt;
  amixer&lt;br /&gt;
&lt;br /&gt;
displays a list of &amp;quot;simple controls&amp;quot;; for my headphones and the on-board sound, the output is this:&lt;br /&gt;
&lt;br /&gt;
  Simple mixer control &#039;Headphone&#039;,0&lt;br /&gt;
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined&lt;br /&gt;
    Playback channels: Mono&lt;br /&gt;
    Limits: Playback -10239 - 400&lt;br /&gt;
    Mono: Playback 0 [96%] [0.00dB] [on]&lt;br /&gt;
&lt;br /&gt;
In this case there is only 1 control, &#039;Headphone&#039;, so I issue this command to lower the maximum volume to a comfortable level (50% in my case).&lt;br /&gt;
&lt;br /&gt;
  amixer sset Headphone 50%&lt;br /&gt;
&lt;br /&gt;
The IQaudIO DAC that I use has a much longer set of controls. I issued this command to set the volume:&lt;br /&gt;
&lt;br /&gt;
  amixer sset &#039;Digital&#039; 50 # quotes may be required if there are spaces in the control name&lt;br /&gt;
&lt;br /&gt;
Note that there can be several interlinked controls, some of which are muted by defualt. ALSA (and other audio software on Linux) is notoriously under-documented, try `man amixer` for more information. Sometimes it is easier to use a more visual control to change the configuration:&lt;br /&gt;
&lt;br /&gt;
  alsamixer&lt;br /&gt;
&lt;br /&gt;
Finally, if you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20002</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20002"/>
		<updated>2021-08-04T09:45:03Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Getting the Speaker(s) Working */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible to test by using headphones instead of active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis. This Wiki has several articles about installing Alpine on a Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Enable writing to the boot media:&lt;br /&gt;
&lt;br /&gt;
  mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
&lt;br /&gt;
Then either enable the on board sound:&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtparam=audio=on&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
or your fancier sound card (e.g. IQaudIO):&lt;br /&gt;
&lt;br /&gt;
  echo &amp;quot;dtoverlay=iqaudio-dacplus,unmute_amp&amp;quot; &amp;gt;&amp;gt; /media/mmcblk0p1/usercfg.txt&lt;br /&gt;
&lt;br /&gt;
and then reboot your Pi.&lt;br /&gt;
&lt;br /&gt;
Follow [https://wiki.alpinelinux.org/wiki/ALSA these instructions] to enable ALSA. In summary&lt;br /&gt;
  &lt;br /&gt;
  apk add alsa-utils alsa-utils-doc alsa-lib alsaconf # the required software for sound&lt;br /&gt;
  aplay -l # should display a List of PLAYBACK Hardware Devices&lt;br /&gt;
&lt;br /&gt;
In my case my list is:&lt;br /&gt;
&lt;br /&gt;
  **** List of PLAYBACK Hardware Devices ****&lt;br /&gt;
  card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]&lt;br /&gt;
    Subdevices: 8/8&lt;br /&gt;
    Subdevice #0: subdevice #0&lt;br /&gt;
    Subdevice #1: subdevice #1&lt;br /&gt;
    Subdevice #2: subdevice #2&lt;br /&gt;
    Subdevice #3: subdevice #3&lt;br /&gt;
    Subdevice #4: subdevice #4&lt;br /&gt;
    Subdevice #5: subdevice #5&lt;br /&gt;
    Subdevice #6: subdevice #6&lt;br /&gt;
&lt;br /&gt;
If you issue this command:&lt;br /&gt;
&lt;br /&gt;
  speaker-test -t wav -c 2&lt;br /&gt;
&lt;br /&gt;
Then you should hear &amp;quot;Front Left, Front Right&amp;quot; repeating from your chosen speakers. Now it&#039;s time to setup Bluetooth. Don&#039;t forget to save your changes (lbu commit) before moving on.&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20001</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20001"/>
		<updated>2021-08-04T09:15:48Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Getting the Speaker(s) Working */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. It is possible, for testing only, to use headphones instead of the active speakers.&lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis.&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20000</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=20000"/>
		<updated>2021-08-04T09:09:54Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* An active speaker or sound card and passive speaker(s)&lt;br /&gt;
&lt;br /&gt;
=Getting the Speaker(s) Working=&lt;br /&gt;
The audio hardware can range from using the Raspberry Pi&#039;s on board audio with an external (active) travel speaker to wiring up an amplifier to some high-end passive speakers.&lt;br /&gt;
&lt;br /&gt;
I&#039;m testing this using Raspberry Pi&#039;s excellent IQaudio DigiAMP+ board with a pair bookshelf speakers and an old (active) travel speaker using the on board audio. &lt;br /&gt;
&lt;br /&gt;
Once the speaker(s), and possibly amplifier, are wired into the Pi, it&#039;s time to install a fresh version of Alpine Linux.  The armv7 version from the [https://alpinelinux.org/downloads/ Downloads] page works on almost all Pis.&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
Raspberry Pi&#039;s blog on [https://www.raspberrypi.org/blog/how-to-play-sound-and-make-noise-with-your-raspberry-pi/ How to play sound and make noise with your Raspberry P]&lt;br /&gt;
&lt;br /&gt;
There are lots of speaker and amplifier options:&lt;br /&gt;
* Raspberry Pi&#039;s [https://www.raspberrypi.org/blog/iqaudio-is-now-raspberry-pi/ IQaudIO boards]&lt;br /&gt;
* Pimoroni&#039;s [https://shop.pimoroni.com/products/audio-amp-shim-3w-mono-amp Audio Amp SHIM (3W Mono Amp)] and [https://shop.pimoroni.com/products/mini-speaker-4-3w Mini Speaker 4Ω (3W)]&lt;br /&gt;
* The Pi Hut offers this [https://thepihut.com/products/adafruit-i2s-3w-stereo-speaker-bonnet-for-raspberry-pi Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi (Mini Kit)] and the [https://thepihut.com/products/stereo-enclosed-speaker-set-3w-4-ohm Stereo Enclosed Speaker Set - 3W 4 Ohm]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=19999</id>
		<title>Raspberry Pi Bluetooth Speaker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_Bluetooth_Speaker&amp;diff=19999"/>
		<updated>2021-08-04T08:06:59Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: How to make a Raspberry Pi Bluetooth speaker&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=How To Build a Raspberry Pi Bluetooth Speaker=&lt;br /&gt;
&lt;br /&gt;
This articles describes how to build a Bluetooth speaker. This article is being actively written.&lt;br /&gt;
&lt;br /&gt;
=Before You Start=&lt;br /&gt;
You’ll need:&lt;br /&gt;
* A Raspberry Pi&lt;br /&gt;
* A Bluetooth USB dongle (if your Pi doesn’t have Bluetooth on board)&lt;br /&gt;
* A speaker&lt;br /&gt;
* Optionally, a sound card&lt;br /&gt;
&lt;br /&gt;
=Doing Something Title=&lt;br /&gt;
Write the steps of how to do something in this section.&lt;br /&gt;
If possible, show an example first, then tell your readers the steps.&lt;br /&gt;
Break this procedure into separate procedures to avoid more than&lt;br /&gt;
about 7-9 steps per procedure.&lt;br /&gt;
&lt;br /&gt;
 INSERT GREAT EXAMPLE HERE&lt;br /&gt;
&lt;br /&gt;
#Answer the following three questions, at least in your head.&lt;br /&gt;
##What do I explain how to do?&lt;br /&gt;
##How do I do that?&lt;br /&gt;
##What do HOWTO readers already know about doing that?&lt;br /&gt;
#Write up a good example. This ensures you can do it.&lt;br /&gt;
#Write up the steps to do it.&lt;br /&gt;
#Write the background info/prerequisites readers need.&lt;br /&gt;
#Write the summary.&lt;br /&gt;
#Clean up your work.&lt;br /&gt;
#Revise, revise, revise.&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
If you ought to point your readers to related information&lt;br /&gt;
they no doubt need but that does not fit in your HOWTO, add links here.&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=19998</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=19998"/>
		<updated>2021-08-04T07:55:51Z</updated>

		<summary type="html">&lt;p&gt;Jchidley: /* Raspberry Pi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Todo|This material needs to be re-organized .. as &#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; and &#039;&#039;&#039;tutorials are more detailed document&#039;&#039;&#039; both need to be reordered as independent sections }}&lt;br /&gt;
&lt;br /&gt;
[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The tutorials are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; contributions on those pages must be complete articles as well as requesting topics to be covered, don&#039;t override already made contributions. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
&lt;br /&gt;
== New users and Newbies ==&lt;br /&gt;
&lt;br /&gt;
* [[Newbie Alpine Ecosystem]] (for overall information in funny sections)&lt;br /&gt;
&lt;br /&gt;
==== Installation: Use cases ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie install manual]]&lt;br /&gt;
** [[Alpine Install: from a disc to a new computer single only boot]]&lt;br /&gt;
** [[Alpine Install: from a disc to a old computer single only boot]]&lt;br /&gt;
** [[Alpine Install: from a disc to a virtualbox machine single only]]&lt;br /&gt;
** [[Alpine Install: from a iso to a virtualbox machine with external disc]]&lt;br /&gt;
* [[Alpine_newbie_install_manual#Ways_to_install_Alpine_listed_by_architectures|Ways to install listed by architectures]]&lt;br /&gt;
** [[Alpine_newbie_install_manual#x86_64_x86_32_x86|x86_64 x86_32 x86 s390]]&lt;br /&gt;
** [[Alpine_newbie_install_manual#armhf_armv7|armhf armv7 aarch64]]&lt;br /&gt;
** [[Alpine_newbie_install_manual#ppc64le|ppc64le others PPC]]&lt;br /&gt;
&lt;br /&gt;
==== Postinstall: desktops and applications ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie apk packages|Overall info and minimal packages common to any working desktop]]&lt;br /&gt;
** [[Alpine newbie desktops|Alpine newbie desktops, (overall information only)]]&lt;br /&gt;
** [[XFCE Setup]]&lt;br /&gt;
** [[Alpine Newbies LXDE Desktop Environment]]&lt;br /&gt;
** [[Alpine Newbies Openbox Window Manager|Alpine Newbies Xorg and Openbox Window Manager]]&lt;br /&gt;
** [[MATE|Alpine Newbies MATE Desktop Environment]]&lt;br /&gt;
* [[Alpine and UEFI|Alpine and UEFI Support Status and related topics]]&lt;br /&gt;
&lt;br /&gt;
==== Developers: compilers, IDEs and tools ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
** [[Alpine newbie developer: gitea|Alpine newbie developer: Git management web frontend gitea]]&lt;br /&gt;
** [[Alpine newbie developer: full stack web]]&lt;br /&gt;
&lt;br /&gt;
==== Servers: deploy in production ====&lt;br /&gt;
&lt;br /&gt;
* [[Alpine production deploy]]&lt;br /&gt;
** [[Production Web server: Lighttpd‎‎]]&lt;br /&gt;
** [[Production DataBases : mysql]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
* Alpine production monitoring&lt;br /&gt;
** [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
** [[Zabbix|Zabbix - the professional complete manager]]&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Raid Administration]]&lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up LVM on LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[Setting up NBD]]&lt;br /&gt;
* [[Setting up ZFS on LUKS]]&lt;br /&gt;
* [[Setting up ZFS with native encryption]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Partitioning and Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is the preferred way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[How to set up Alpine as a wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Seafile: setting up your own private cloud]]&lt;br /&gt;
&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_apk_packages|Alpine newbie users post install and easy setups]]&lt;br /&gt;
** [[Alpine_newbie_apk_packages#New_users:_hostname_and_network_wired_connection|First steps at post install]]&lt;br /&gt;
** [[Alpine_newbie_apk_packages#New_users:_common_needed_package_to_install|Enable repositories]]&lt;br /&gt;
** [[Alpine_newbie_apk_packages#New_users:_management_of_users_and_logins|Added the first user to use the system]]&lt;br /&gt;
** [[Alpine_newbie_apk_packages#install_basic_tools|First packages to install]] (need the previous [[Alpine_newbie_apk_packages#New_users:_common_needed_package_to_install|Enable repositories]]) already done!&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a new user]]&lt;br /&gt;
* [[Enable Community Repository]] &#039;&#039;(Providing additional packages)&#039;&#039;&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
&amp;lt;!-- Obsolete?&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[How to get regular stuff working]] &#039;&#039;some notes on need-to-know topics&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java]]&lt;br /&gt;
* [[Rsnapshot|Setting up periodic backups with &amp;lt;samp&amp;gt;rsnapshot&amp;lt;/samp&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization==&lt;br /&gt;
&lt;br /&gt;
* [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
* [[Xen Dom0 on USB or SD]]&lt;br /&gt;
* [[Create Alpine Linux PV DomU]]&lt;br /&gt;
* [[Xen PCI Passthrough]]&lt;br /&gt;
* [[Xen LiveCD]]&lt;br /&gt;
* [[qemu]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Install_Alpine_on_VirtualBox]]&lt;br /&gt;
* [[Install Alpine on VMWare]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[Awesome(wm) Setup]]&lt;br /&gt;
* [[dwm]] &#039;&#039;(dynamic window manager for X)&#039;&#039;&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Gnome Setup]]&lt;br /&gt;
* [[KDE]]&lt;br /&gt;
* [[MATE|MATE Setup]]&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Owncloud]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
** (to be merged with [[OwnCloud]] &#039;&#039;(Your personal Cloud for storing and sharing your data on-line)&#039;&#039;)&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Sway]]&lt;br /&gt;
* [[XFCE Setup]] and [[Xfce Desktop|Desktop Ideas]]&lt;br /&gt;
* [[Installing Adobe flash player for Firefox]]&lt;br /&gt;
* [[Sound Setup]]&lt;br /&gt;
* [[PipeWire]]&lt;br /&gt;
* [[Printer Setup]]&lt;br /&gt;
* [[Default applications]]&lt;br /&gt;
&lt;br /&gt;
== Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi (Installation)]]&lt;br /&gt;
* [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]]&lt;br /&gt;
* [[RPI Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi Zero W - Installation]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker]]&lt;br /&gt;
&lt;br /&gt;
== PowerPC ==&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powepc64le (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== IBM Z (IBM z Systems) ==&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x (Installation)]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server 3.x HowTo]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx_with_PHP#Nginx_with_PHP|Nginx with PHP]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a nfs-server]]&lt;br /&gt;
* [[Setting up a samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine_newbie_developer: gitea|Setting up Git management web frontend gitea]]&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[How To Setup Your Own IRC Network]] &#039;&#039;(Using {{Pkg|charybdis}} and {{Pkg|atheme-iris}})&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
* [[IPTV How To|Internet Protocol television (IPTV)]]&lt;br /&gt;
* [[UniFi_Controller]]&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* Setting up [[collectd]]&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[LTTng]] &#039;&#039;(Kernel and userspace tracing)&#039;&#039;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
* [[Kernel Modesetting]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Alpine on the Aopen Chromebase or Chromebox Mini with Mainline Kernel]]&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
* [[Building a cloud with Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small_Office_Services]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;/div&gt;</summary>
		<author><name>Jchidley</name></author>
	</entry>
</feed>