-
Notifications
You must be signed in to change notification settings - Fork 141
FullPageOS with pikaraoke (Oct 2024)
This howto was written by @romeo1984. Original discussion post is here
So, I've been running PiKaraoke since it was first posted. It has undergone a necessary evaluation that allowed for ease of supportability and portability across platforms. My particular use case was to have a Pi device that was a dedicated karaoke machine that was easy to use and share with friends who also liked my parties and wanted to have their own device for their own parties. The original pikaraoke version can be installed on a server-only OS that output video directly to the video port on my pi4 device. I also have 65,000 CDG files that I had to have because there were a lot of obscure songs that don't have a more modern MP4 version out there on YouTube.
Because there are several people here who have the same use case as me, I decided to create this How-To that achieves both adaptability and functionality in line with what the code authors are trying to do here. I intend to care and feed this thread as long as I can keep up with code releases.
What this How-To is NOT: If you have a different requirement, then this is not a help board. Please seek your own solution. You can post your issue as long as you found a solution and you think others can benefit from it. As an example, WiFi configuration seems to be an on-going issue for some people. Being I use Ethernet, I a not interested in seeing issues about your WiFi configuration - Please use the "Issues" section.
Here we go!
My Requirements:
- Pi 4
- Argon Case and Remote
- The device is hooked up to an HDMI port on my 65" TV full-time
- Use the 3.5mm headphone jack - Connected to an EQ and mixer, then to a stereo system
- Needs to play both MP4 and CDG files
- No system boot-up messages
- Party members can also access pikaraoke on my private network
- The device connects to Ethernet
- No Desktop Env
Skills required:
- Know how to install an OS onto a pi device
- Have an understanding of Linux
- Can use some SSH client
- Can use Nano or VI to edit files
My Bill of Materials:
- Pi4 4 GB RAM
- Argon-1 Case
- Argon SSD add-on (They also have an NVE version)
- Argon Remote
- 500 GB SSD Stick (because I have 300GB in karaoke files)
Versions
- Platform == Raspberry Pi 4 Model B Rev 1.4
- PiKaraoke == 1.5.1
- OS == Debian 1:6.6.20-1+rpt1 (2024-03-07) (bookworm)
- chromium-browser == Chromium 122.0.6261.89 Built on Raspbian , running on Raspbian 12
- ffmpeg == 5.1.6-0+deb12u1+rpt1
- yt-dlp == 2024.10.07
Steps:
- Switch the Pi-4 boot source from SD to USB
- Install the OS Image on the 500GB drive. FullPageOS Image from here: https://unofficialpi.org/Distros/FullPageOS/nightly/ (I used 2024-03-31_2024-03-15-fullpageos-bookworm-armhf-lite-0.14.0.zip)
- Get the IP address and SSH of the device. I use my networking system to see what new IP address is on my network.
- Update the OS then reboot:
sudo apt-get update && sudo apt-get upgrade -y
sudo reboot
- Install ffmpeg:
sudo apt-get install ffmpeg -y
- Follow the pikaroke install instructions. Create a .venv directory in the homedir:
python -m venv ~/.venv
Activate your virtual environmentsource ~/.venv/bin/activate
Install pikaraoke from PyPipip install pikaraoke
- Create the systemd service:
sudo nano /etc/systemd/system/pikaraoke.service
[Unit]
Description=pikaraoke
After=multi-user.target
[Service]
WorkingDirectory=/home/pi/.venv/
Type=simple
ExecStart=/home/pi/.venv/bin/python /home/pi/.venv/bin/pikaraoke --headless --download-path /home/pi/pikaraoke-songs --volume 0.75 --high-quality
User=root
Group=root
Environment="PATH=$PATH:/home/pi/.venv/bin:/home/pi/.venv/lib/python3.11/site-packages:/usr/bin:/usr/sbin"
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
- Install the service:
sudo systemctl enable pikaraoke.service
Troubleshooting tip: If you have to make changes to the pikaraoke.service file, you have to reload the service in order for the changes to load. Use the following command:
sudo systemctl --system daemon-reload
- Switch the default Kiosk page to pikaraoke splash page:
sudo nano /boot/firmware/fullpageos.txt
Replace the default page with this:
http://localhost:5555/splash?confirm=false
- Reboot and see if pikaraoke launches:
sudo reboot
At this stage, we still need to work on the audio and adjust a few things to get the full Kiosk experience. The splash page can be seen as very small depending on the size of the TV you are working on. My lab has a 19" that looks okay, but when I put it up on my 65" in the living room, the splash page looks tiny. We will fix this shortly.
- Get the audio working:
a. Set the Audio Out to 3.5 Headphone Jack
sudo raspi-config
1 System Options -> S2 Audio -> 69 Headphones -> OK -> Finish
b. Setup ALSA and default volume - The system volume needs to be set or you may experience your speakers overdriving if you try and adjust the karaoke volume in the application. Check devices by running beacue this may move depending on which OS or pi device you are using:
aplay -l
Look to see what device and subdevices the bcm2835 Headphones jack is on:
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] **<-- Card #2 Device #0**
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
Edit the ALSA config to match the above settings:
sudo nano /usr/share/alsa/alsa.conf
defaults.ctl.card 2
defaults.pcm.card 2
defaults.pcm.device 0
defaults.pcm.subdevice 0
Intsall the PulseAudio utilities so we can set the default volume (your level may be different. Start with 70%)
sudo apt install pulseaudio -y
sudo reboot
Set the volume:
amixer set Master 70%
sudo alsactl store
At this point, pikaraoke should work 100%. Try searching for a YouTube file to play.
- Setup for more of a Kiosk experience: a. Change the Loading Page (Here is my custom graphic): Click to download and Transfer the "loading" graphic file via SCP to '/home/pi/loading.png' (The full graphic is obscured here):
sudo nano /opt/custompios/scripts/run_onepageos
feh --bg-scale /home/pi/loading.png
#feh --bg-center /opt/custompios/background.png
Trouble-shooting Tip: If you turn on your pikaraoke device and this screen hangs (pikaraoke does not load) then it means there was an issue. using SSH query the service and logs to see what the error is:
sudo service pikaraoke status
journalctl -u pikaraoke.service
b. For big TVs you will need to increase the size of the pikaraoke splash page. Mine is a 65" Samsung 4k, so, these settings worked for me. You might have to adjust the factor multiplier to fit your size of TV.
sudo nano ~/scripts/start_chromium_browser
Add to the "flags=()" section:
--force-device-scale-factor=4.0 %U
c. Remove the Linux system messages when booting up:
sudo nano /boot/firmware/cmdline.txt
Change: consoleblank=1
- (OPTIONAL) Install the Samba share to transfer your awesome karaoke library to (Note that the User will depend on your OS install):
I like to organize my MP4s and CDGs in separate directories. Notice that the pikaraoke startup switch will send the downloaded MPs to '/home/pi/pikaraoke-songs/'.
Create the directories and apply world permissions (this is for ease of functionality. You can tighten this down if you wish):
mkdir /home/pi/pikaraoke-songs/CDG
mkdir /home/pi/pikaraoke-songs/YT
sudo chmod 0777 /home/pi/pikaraoke-songs/CDG
sudo chmod 0777 /home/pi/pikaraoke-songs/YT
sudo chmod 0777 /home/pi/pikaraoke-songs/
sudo apt-get install samba samba-common-bin
sudo nano /etc/samba/smb.conf
Add the following section:
[karaoke]
comment = Shared folder
path = /home/pi/pikaraoke-songs/
browseable = yes
writeable = yes
only guest = no
force user = pi **<-- This will be the user you configured in the OS that you have been signing in as**
create mask = 0777
directory mask = 0777
public = yes
guest ok = yes
sudo service smbd restart
sudo service nmbd restart
On your library computer, browse to \\karaoke. Transfer your files using the share. Sign in as your pi username. In this case, it will be "pi". We will disable this service later.
- (OPTIONAL) Install ARGON utilities for the Remote and Fan:
wget https://download.argon40.com/argon1.sh
sudo chmod 700 argon1.sh
sudo ./argon1.sh
sudo argon-config
Set the remote and fan to the desired parameters.
- Disable unnecessary services (some may not exist):
sudo systemctl disable lighttpd.service
sudo systemctl disable bluetooth.service
sudo systemctl disable x11vnc.service
(This is a work around that corrects a bug in the OS build)
sudo mkdir -p /var/lib/userconf-pi
sudo touch /var/lib/userconf-pi/autologin
sudo systemctl set-default graphical.target
sudo systemctl disable triggerhappy.service
sudo systemctl disable printing.service
sudo systemctl disable splashscreen.service
(After your file transfer is complete)
sudo systemctl disable smbd.service
sudo systemctl disable nmbd.service
- That's it! Reboot and see if everything works!