Skip to content

Commit f122017

Browse files
committed
Initial release
1 parent a043000 commit f122017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1726
-1
lines changed

LICENSE.sig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-----BEGIN PGP SIGNATURE-----
2+
3+
iQIzBAABCAAdFiEEdx2/W0ilDF1TE/WwkA+JNtj5zjcFAl6z5UEACgkQkA+JNtj5
4+
zje0hRAAmIA8lGLUtMXXLP+62BzWgLMJw18hdzxLMliaccUGd0MqfWwdFEGB2Feb
5+
+wXONeFAgRtBcAmIbFeg4MKgr54fuMbJH8ZcGXcHbl/i34HgPKLXI4t1oAob90SI
6+
2oMZXg1pekmH9ziGxg+sf5CYp2JGYqqUIcj0UJx4Csa9riQODguv22nW9ESIREGU
7+
xSWTC/4GDHy8v6wUCRmfKuWFOAdD2t5isjMf8lOuT9YgEXDtENc9XDEBQ9oREITN
8+
cGsjRy8RbpaWmrdSzSUpOhnnJdKddDXk3KS1SkN7AXVxst2++PB0MDWcn9JgWt08
9+
LboSPiI9b/07LUCtrsz9b8KaMUvF8iNcc+OBtqQa/30M8k+3dQTXYTWZjkw/Y1Ox
10+
Xcpf9nbQ0QPsRSors+qb8j3GUgRkzVRos2t6y9wMGZiA3xETEi5QyX1m3sJjethI
11+
i2Gq9SAfF3BccPw0BNygkOGN04BpRQUjHlMC62DHcaV8to2GM34UBN4Kh9UK2OWF
12+
mhMyiiWyJ3RCGCfMOxf6Ia4t9hbFXxIuUKh+uWclCjApe0rmkdZDx7fxzxb4BIhT
13+
AsSHBdCdFnHawqu7c90QnHJNquTRt79+QBQQVnchnudUcEpPNP64h0SK2mtyFvZG
14+
baDnHBbLhlreKC8817xYHjeGCxVZCp1Lwyto6ApuOL2/DY9MOxo=
15+
=xHOU
16+
-----END PGP SIGNATURE-----

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,88 @@
11
# tiny-radioCD
2-
small footprint mpd-based radioCD player, for bluetooth speakers & headphones
2+
A small-footprint radioCD player, for Bluetooth speakers, headphones, car-audio systems,...
3+
4+
This personal project is geared towards simple & essential use-cases for casual listeners using Bluetooth speakers, and missing their good-old Audio CDs playback...
5+
6+
7+
8+
<u>Main Features:</u>
9+
10+
- Audio-CD & web radio player
11+
12+
- Sound output to any Bluetooth audio equipment, and available default audio port (can be HiFi DAC)
13+
14+
- Simple remote control via Bluetooth keys and/or network mpc client
15+
16+
- Focus on ease of use & efficiency under low memory & hardware requirements (based on [AlpineLinux](https://www.alpinelinux.org/))
17+
18+
- Headless operation, one-touch update
19+
20+
21+
22+
**tiny-radioCD** just relies on [MPD](https://www.musicpd.org/), ALSA and [bluez-alsa](https://github.com/Arkq/bluez-alsa/): it does not need to provide a graphical remote UI.
23+
Typically runs in 50MB of RAM on a low-cost PiZero device (135 MB rootf suitable for RAM-only operation).
24+
Check-out our minimalistic USB-powered [PiZeroWed-Mac mini](https://github.com/macmpi/tiny-radioCD/wiki)!
25+
26+
Though mostly tested on Pi, it would run on any AlpineLinux supported platform (diskless/data/sys modes).
27+
Some ready-to-use images are available (Raspberry Pi armhf ram-only SD archive for instance).
28+
Customized installs can be included as simple addon-scripts (refer to available Pi example)
29+
30+
31+
32+
#### Seamless user operation:
33+
34+
Player control (play/pause/etc...) is naturally operated with bluetooth speaker/headphone ***built-in keys***.
35+
Volume adjustment is set by speaker amplification stage.
36+
37+
***Multimedia bluetooth remotes*** are a perfect match too, allowing extended use-cases.
38+
Typically, the low-cost first-generation ***FireTV remote*** (& clone) works great (more info in [Wiki](https://github.com/macmpi/tiny-radioCD/wiki)).
39+
***USB Keyboards*** with multimedia keys are supported too.
40+
41+
With network availability, any ***mpc client application*** can easily connect to **tiny-radioCD** player with Avahi discovery, and provide convenient user interface.
42+
[***MaximumMPD***](https://itunes.apple.com/gb/app/maximummpd/id1437096437?mt=8) on iOS is a good example of such clients, but there are many other available on any platforms.
43+
44+
***Hardware buttons*** (power on/off, eject) availability depend on actual devices running tiny-radioCD, and can easily be customized: i.e. on Pi, simple on/off push-button can be enabled with `dtoverlay=gpio-shutdown` in `usercfg.txt`.
45+
46+
***mpc commands*** also work under console or ssh, as last resort...
47+
48+
49+
50+
#### Install procedure:
51+
52+
If you don't use ready-made images, just do the following on your [AlpineLinux device](https://wiki.alpinelinux.org/wiki/Installation) with internet access:
53+
`cd /tmp`
54+
`wget -O tiny-radioCD.zip https://github.com/macmpi/tiny-radioCD/archive/master.zip`
55+
`unzip -oq tiny-radioCD.zip`
56+
`cd tiny-radioCD`
57+
`chmod +x setup-tiny-radioCD`
58+
`sudo ./setup-tiny-radioCD`
59+
60+
After install, bluetooth speaker pairing (and eventual remote command pairing) may be done under console or ssh (alternatively, check *[easy-setup](https://github.com/macmpi/tiny-radioCD/wiki)* section in Wiki):
61+
`sudo bluetoothctl` After a <u>scan</u>, make sure you <u>pair</u>, <u>connect</u> and <u>trust</u> your bluetooth devices.
62+
Take note of your speaker MAC address `XX:XX:XX:XX:XX:XX` in your home directory with:
63+
`printf "XX:XX:XX:XX:XX:XX" > myspeaker`
64+
Then finish speaker setup with the below command:
65+
`sudo set-speaker myspeaker` this command may greatly help switching between paired speakers later.
66+
(if running in diskless mode, do not forget to commit changes after pairing: `lbu commit -d`)
67+
68+
Reboot to take advantage of your new **tiny-radioCD**!
69+
70+
71+
72+
#### Versions history:
73+
74+
```
75+
0.5: (May 17th 2020)
76+
- initial release, Alpine 3.11
77+
```
78+
79+
80+
81+
#### Contributions:
82+
83+
Contributions are welcome in `dev` branch.
84+
85+
86+
87+
<u>Side note:</u> several very generic & complete packages exist, with extensive feature-set & remote Web UI service (special credits to [Volumio2](https://volumio.org/)): great stuff too, different use-cases focus.
88+

addons/_updates-post

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
# Note: this file is included so all upper variables work
8+
# do NOT change directory inside here, or cd "$srcdir" at the end!...
9+
10+
11+
# This is intended to cleanup previous versions leftovers AFTER update
12+
# Typically in this order:
13+
# 1) restore some settings or files to be restored in _updates-post
14+
15+
16+
# Leftovers v x.y:
17+
18+
19+
20+
21+
22+
23+
24+
# Leftovers v z.t:

addons/_updates-pre

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
# Note: this file is included so all upper variables work
8+
# do NOT change directory inside here, or cd "$srcdir" at the end!...
9+
10+
11+
# This is intended to cleanup previous versions leftovers before update
12+
# Typically in this order:
13+
# 1) service <old_service> stop
14+
# 2) rc-update del <old_service>
15+
# 3) remove leftover old_service, utilities, files & folders
16+
# 4) preserve some settings or files to be restored in _updates-post
17+
18+
19+
# Leftovers v x.y:
20+
21+
22+
23+
24+
25+
26+
27+
# Leftovers v z.t:

addons/pi

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/sh
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
# Note: this file is included so all upper variables work
8+
# do NOT change directory inside here, or cd "$srcdir" at the end!...
9+
10+
11+
# Limited Pi-specific customizations regarding rng-tools, pi-bluetooth initd service,
12+
# swclock & easy-setup
13+
14+
echo "Installing Pi specific tweaks"
15+
16+
apk -u add rng-tools bluez-deprecated@emain --update-cache \
17+
|| { echo >&2 "Install failed, exiting! (for clues: apk -s fix)"; exit 1; }
18+
19+
rc-update add rngd boot 2>&1 # same as wpa_supplicant for providing entropy
20+
21+
22+
# on Pi no hardware clock
23+
service hwclock stop 2>&1
24+
rc-update del hwclock boot 2>&1
25+
service swclock start 2>&1
26+
rc-update add swclock boot 2>&1
27+
28+
# Pi Specific service to load bluetooth firmware until done via device-tree
29+
install -m755 "$srcdir"/usr/local/bin/btuart /usr/local/bin/btuart
30+
install -m755 "$srcdir"/etc/init.d/pi-bluetooth /etc/init.d/pi-bluetooth
31+
rc-update add pi-bluetooth sysinit 2>&1
32+
33+
# Fix eventually missing brcm NVRAM firmware file for PiZeroW
34+
# will only work on sys mode (other modes /lib/firmware is not writeable initramfs)
35+
grep -q "Raspberry Pi" /proc/cpuinfo && \
36+
! [ -f /lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt ] && \
37+
ln -sfn brcmfmac43430-sdio.raspberrypi,3-model-b.txt \
38+
/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt
39+
40+
41+
42+
#################################
43+
# Modify SD content: easy-setup and boot options
44+
mount -o remount,rw /dev/mmcblk0p1 /media/mmcblk0p1
45+
46+
# Enable easy-setup on SD and add default config file sample
47+
mkdir -p /media/mmcblk0p1/_tiny-radioCD
48+
install "$srcdir"/tiny-radioCD.conf /media/mmcblk0p1/_tiny-radioCD/tiny-radioCD.conf
49+
ln -sfn /media/mmcblk0p1/_tiny-radioCD /etc/tiny-radioCD
50+
51+
52+
# Pi eventual supplements for config.txt or usrcfg.txt
53+
54+
# Disable the rainbow splash screen (will not add if there and commented)
55+
grep -q "disable_splash=1" /media/mmcblk0p1/usercfg.txt || \
56+
echo "disable_splash=1" >> /media/mmcblk0p1/usercfg.txt
57+
58+
# Set the bootloader delay to 0 seconds. Default is 1s if not specified.
59+
# (will not add if there and commented)
60+
grep -q "boot_delay=0" /media/mmcblk0p1/usercfg.txt || \
61+
echo "boot_delay=0" >> /media/mmcblk0p1/usercfg.txt
62+
63+
# built-in audio, and HDMI audio (will not add if there and commented)
64+
grep -q "dtparam=audio=on" /media/mmcblk0p1/usercfg.txt || \
65+
echo "dtparam=audio=on" >> /media/mmcblk0p1/usercfg.txt
66+
67+
grep -q "force_hdmi_open=1" /media/mmcblk0p1/usercfg.txt || \
68+
echo "force_hdmi_open=1" >> /media/mmcblk0p1/usercfg.txt
69+
70+
71+
# ON/OFF button on GPIO3
72+
#dtoverlay=gpio-shutdown
73+
74+
# External activity LED on GPIO 21
75+
#dtparam=act_led_gpio=21
76+
77+
# gpu_mem MUST be set in original config.txt, not in include
78+
# https://github.com/raspberrypi/firmware/issues/1332#issuecomment-584166999
79+
# gpu_mem=16 (requires _cd files to be installed)
80+
81+
mount -o remount,ro /dev/mmcblk0p1 /media/mmcblk0p1
82+
83+
84+
85+
86+
#################################
87+
# Preserve local specific stuff according to install modes
88+
89+
if !(grep -q "root=" /proc/cmdline); then #we are not in sys mode (so data or diskless)
90+
# stuff of matter for diskless or data mode
91+
lbu include /etc/init.d/pi-bluetooth
92+
93+
if !(grep -q "/var" /etc/fstab); then #we are not in data mode: hence diskless only
94+
# stuff from /var for diskless mode
95+
:
96+
fi
97+
fi
98+
99+
100+
echo "Done with Pi specific tweaks"

create-user

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/expect -f
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
# creates a new user with username and pass provided as input
8+
set username [lindex $argv 0];
9+
set pass [lindex $argv 1];
10+
set promp "#"
11+
12+
13+
log_user 0; # suppress all logs to stdout: remove to enable or log_user 1
14+
15+
set timeout 1
16+
spawn adduser -h /tmp $username
17+
18+
expect "New password:"
19+
send "$pass\r"
20+
21+
expect "Retype password:"
22+
send "$pass\r"
23+
24+
expect "changed by root"

etc/acpi.map

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
2+
# check License at project home https://github.com/macmpi/tiny-radioCD
3+
4+
5+
# FORMAT: "<EV_XXX>" <type> "<input.h name>" <keycode> <value> <script under /etc/acpi>
6+
# hint: "evtest /dev/input/eventX" is very helpful!
7+
# https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
8+
9+
10+
"EV_SW" 0x05 "SW_LID" 0 1 "button/lid LID 00000080" # base
11+
12+
"EV_KEY" 0x01 "KEY_KPENTER" 96 1 "NIL" # remapped FireTV remote (do nothing)
13+
"EV_KEY" 0x01 "KEY_UP" 103 1 "EJECT" # remapped FireTV remote
14+
"EV_KEY" 0x01 "KEY_LEFT" 105 1 "REWIND_TRACK" # remapped FireTV remote
15+
"EV_KEY" 0x01 "KEY_RIGHT" 106 1 "SWAP_PLAYLISTS" # remapped FireTV remote
16+
"EV_KEY" 0x01 "KEY_DOWN" 108 1 "POWEROFF" # remapped FireTV remote
17+
18+
"EV_KEY" 0x01 "KEY_POWER" 116 1 "POWEROFF" # base unit power button
19+
20+
"EV_KEY" 0x01 "KEY_MENU" 139 1 "SEQUENCE" # remapped FireTV remote
21+
"EV_KEY" 0x01 "KEY_BACK" 158 1 "RANDOM" # remapped FireTV remote
22+
23+
"EV_KEY" 0x01 "KEY_EJECTCD" 161 1 "EJECT"
24+
"EV_KEY" 0x01 "KEY_EJECTCLOSECD" 162 1 "EJECT"
25+
"EV_KEY" 0x01 "KEY_NEXTSONG" 163 1 "NEXT"
26+
"EV_KEY" 0x01 "KEY_PLAYPAUSE" 164 1 "PLAY_PAUSE"
27+
"EV_KEY" 0x01 "KEY_PREVIOUSSONG" 165 1 "PREVIOUS"
28+
29+
"EV_KEY" 0x01 "KEY_REWIND" 168 1 "PREVIOUS" # remapped FireTV remote
30+
31+
"EV_KEY" 0x01 "KEY_HOMEPAGE" 172 1 "TRACK_1" # remapped FireTV remote
32+
33+
"EV_KEY" 0x01 "KEY_PLAYCD" 200 1 "PLAY_PAUSE"
34+
"EV_KEY" 0x01 "KEY_PAUSECD" 201 1 "PLAY_PAUSE"
35+
"EV_KEY" 0x01 "KEY_FASTFORWARD" 208 1 "NEXT"
36+
37+
38+
# "EV_KEY" 0x01 "KEY_XXX" XXX 1 "UPDATE"
39+
# "EV_KEY" 0x01 "KEY_XXX" XXX 1 "EASY_SETUP"
40+
# "EV_KEY" 0x01 "KEY_XXX" XXX 1 "CONNECT_SPKR"
41+
# "EV_KEY" 0x01 "KEY_XXX" XXX 1 "SWITCH_SPKR"
42+

etc/acpi/remote/CONNECT_SPKR

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh -l
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
connect-spkr

etc/acpi/remote/EJECT

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh -l
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
radiocd-cmd eject

etc/acpi/remote/FASTFORWARD

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh -l
2+
3+
# Part of tiny-radioCD project, originally designed & hand-crafted by macmpi
4+
# check License at project home https://github.com/macmpi/tiny-radioCD
5+
6+
7+
mpc seek +5 > /dev/null 2>&1

0 commit comments

Comments
 (0)