From a6bd25163a28f23bafb36673c13042d054ecf4c9 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 5 Aug 2020 21:47:49 -0400 Subject: [PATCH] liquidsoap thx boatbod --- .../apps/example_liquidsoap.liq | 73 +++++++++++++++++++ op25/gr-op25_repeater/apps/op25-liq.service | 15 ++++ op25/gr-op25_repeater/apps/op25.liq | 54 ++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 op25/gr-op25_repeater/apps/example_liquidsoap.liq create mode 100644 op25/gr-op25_repeater/apps/op25-liq.service create mode 100755 op25/gr-op25_repeater/apps/op25.liq diff --git a/op25/gr-op25_repeater/apps/example_liquidsoap.liq b/op25/gr-op25_repeater/apps/example_liquidsoap.liq new file mode 100644 index 0000000..a0ee73e --- /dev/null +++ b/op25/gr-op25_repeater/apps/example_liquidsoap.liq @@ -0,0 +1,73 @@ +#!/usr/bin/liquidsoap + +# Example liquidsoap streaming from op25 to icecast +# (c) 2019, 2020 gnorbury@bondcar.com, wllmbecks@gmail.com +# + +set("log.stdout", true) +set("log.file.path", "/home/pi/op25/op25/gr-op25_repeater/apps/liquidsoap.log") +set("log.file", true) +set("log.level", 3) + +# Make the native sample rate compatible with op25 +set("frame.audio.samplerate", 8000) + +# SOURCE INPUT BLOCK OPTIONS +# Mono and stereo input sources are mutually exclusive. Choose type. + +# Mono input source +input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 2 -s")) +# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25 +# Longer buffer results in less choppy audio but at the expense of increased latency. + +# Left channel input source and audio summing for two-slot protocols +#left = input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -u 23450 -x 2 -s") +#left = audio_to_stereo(left) +#left = stereo.pan(pan=1., left) + +# Right channel input source and audio summing for two-slot protocols +#right = input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -u 23460 -x 2 -s") +#right = audio_to_stereo(right) +#right = stereo.pan(pan=-1., right) + +# OPTIONAL AUDIO SIGNAL PROCESSING BLOCKS +# Uncomment to enable +# +# High pass filter mono +input = filter.iir.butterworth.high(frequency = 200.0, order = 4, input) + +# High pass filter stereo +#left = filter.iir.butterworth.high(frequency = 200.0, order = 4, left) +#right = filter.iir.butterworth.high(frequency = 200.0, order = 4, right) + +# Low pass filter mono +input = filter.iir.butterworth.low(frequency = 3250.0, order = 4, input) + +# Low pass filter stereo +#left = filter.iir.butterworth.low(frequency = 3250.0, order = 4, left) +#right = filter.iir.butterworth.low(frequency = 3250.0, order = 4, right) + +# Normalization mono +input = normalize(input, gain_max = 3.0, gain_min = -3.0, target = -16.0, threshold = -40.0) + +# Normalization stereo -- Note -- Adjust target gains independently to achieve left/right balance +#left = normalize(left, gain_max = 3.0, gain_min = -3.0, target = -16.0, threshold = -40.0) +#right = normalize(right, gain_max = 3.0, gain_min = -3.0, target = -16.0, threshold = -40.0) + +# Commnent out the line below for "non-stereo" (mono) output +#input = mksafe(add(normalize=false, [left,right])) + +# LOCAL AUDIO OUTPUT +# Uncomment the line below to enable local sound +#output.ao(input) + +# ICECAST STREAMING +# Uncomment to enable output to an icecast server +# Change the "host", "password", and "mount" strings appropriately first! +# For metadata to work properly, the host address given here MUST MATCH the address in op25's meta.json file +# +# Mono Stream +output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op25", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25", password="hackme", mean(input)) +# +# Stereo Stream +#output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=true), description="op25", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25", password="hackme", input) diff --git a/op25/gr-op25_repeater/apps/op25-liq.service b/op25/gr-op25_repeater/apps/op25-liq.service new file mode 100644 index 0000000..de485b6 --- /dev/null +++ b/op25/gr-op25_repeater/apps/op25-liq.service @@ -0,0 +1,15 @@ +[Unit] +Description=op25-liq +After=syslog.target network.target nss-lookup.target network-online.target +Requires=network-online.target + +[Service] +User=1000 +Group=1000 +WorkingDirectory=/home/pi/op25/op25/gr-op25_repeater/apps +ExecStart=/usr/bin/liquidsoap op25.liq +RestartSec=5 +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/op25/gr-op25_repeater/apps/op25.liq b/op25/gr-op25_repeater/apps/op25.liq new file mode 100755 index 0000000..b8fc31e --- /dev/null +++ b/op25/gr-op25_repeater/apps/op25.liq @@ -0,0 +1,54 @@ +#!/usr/bin/liquidsoap + +# Example liquidsoap streaming from op25 to icecast +# (c) 2019, 2020 gnorbury@bondcar.com, wllmbecks@gmail.com +# + +set("log.stdout", true) +set("log.file", false) +set("log.level", 1) + +# Make the native sample rate compatible with op25 +set("frame.audio.samplerate", 8000) + +input = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 2 -s")) +# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25 +# Longer buffer results in less choppy audio but at the expense of increased latency. + + + +# OPTIONAL AUDIO SIGNAL PROCESSING BLOCKS +# Uncomment to enable +# +# High pass filter +#input = filter.iir.butterworth.high(frequency = 200.0, order = 4, input) + +# Low pass filter +#input = filter.iir.butterworth.low(frequency = 3250.0, order = 4, input) + +# Normalization +#input = normalize(input, gain_max = 3.0, gain_min = -3.0, target = -16.0, threshold = -40.0) + + + +# LOCAL AUDIO OUTPUT +# Uncomment the appropriate line below to enable local sound +# +# Default audio subsystem +out (input) +# +# PulseAudio +#output.pulseaudio(input) +# +# ALSA +#output.alsa(input) + + + +# ICECAST STREAMING +# Uncomment to enable output to an icecast server +# Change the "host", "password", and "mount" strings appropriately first! +# For metadata to work properly, the host address given here MUST MATCH the address in op25's meta.json file +# +#output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op25", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="mountpoint", password="hackme", mean(input)) +