Close

Onion Omega configuration

A project log for Onion Omega music server

Onion Omega based pulseaudio server

andriymalyshenkoandriy.malyshenko 08/22/2018 at 20:060 Comments

After I start it up and followed initial configuration (manual) I did following steps 

0) Assign fixed ip on my router

1) Added pub key to /etc/dropbear/authorized_keys - so i can ssh to it without password, saves a lot of time

2) Install pulseaudio version 6 (warn: version 9 gives me kernel panic), please check your sources list to be sure

opkg update
opkg install bluez-libs bluez-utils pulseaudio-daemon pulseaudio-tools alsa-lib alsa-utils

3) change pulseaudio start script at /etc/init.d/pulseaudio 

procd_set_param command $PROG --system --disallow-exit --no-cpu-limit --realtime
#procd_set_param command $PROG --system --disallow-exit --no-cpu-limit -v --log-target=file:/tmp/pulse.log

first line - realtime flag solved some sound distortion issues for me

second line is for debug, you can trace issues in the log file

4) change pulse config at /etc/pulse/system.pa

add these lines

### PulseAudio available over the network
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/16 auth-anonymous=1

i had no issues with sound drivers, sounf card just started to work out of the box so to speak

End result:

pactl list sinks short
1	alsa_output.default	module-alsa-sink.c	s16le 2ch 44100Hz	SUSPENDED

 5) At this point it is possible to test network audio from laptop within same network

copy system config from /etc/pulse/default.pa to  ~/.config/pulse/default.pa

Add these line

load-module module-tunnel-sink-new server=192.168.1.80 sink_name=onion

After pulse restart i can select network card in my audio settings and test that audio works fine

6) Add following script at  /sbin/pa-monitor

#!/bin/ash

GPIO=19

function main {

	while (true); do
		state=$(pactl list sources short | awk '{print $7}')

		if [ $state = "SUSPENDED" ]; then
			off;
		else
			on;
		fi

		sleep 1
	done

}

function init {
	gpioctl dirout $GPIO
}

function on {
	echo "ON"
	gpioctl dirout-high $GPIO > /dev/null
}

function off {
	echo "OFF"
	gpioctl dirout-low $GPIO > /dev/null
}

main

Add startup script at /etc/rc.local

/sbin/pa-monitor > /dev/null &

enable  /etc/rc.local

chmod a+x /etc/rc.local

After that relay should automatically swith on amp as soon as audio start playing, when audio switched off after ~15 seconds relay shuts off. 

Discussions