diff --git a/Dockerfile b/Dockerfile index 0659565..905ee1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,13 +18,17 @@ WORKDIR /op25 # Run the install script to set up op25 RUN ./install.sh -f +# Install the op25.liq file +COPY op25.liq /op25/op25/gr-op25_repeater/apps/op25.liq +RUN chmod +x /op25/op25/gr-op25_repeater/apps/op25.liq + # Install Python dependencies COPY requirements.txt /tmp/requirements.txt RUN pip3 install --no-cache-dir -r /tmp/requirements.txt # Create the run_multi-rx_service.sh script -RUN echo "#!/bin/bash\n./multi_rx.py -v 1 -c /configs/active.cfg.json" > ./op25/gr-op25_repeater/apps/run_multi-rx_service.sh && \ - chmod +x ./op25/gr-op25_repeater/apps/run_multi-rx_service.sh +COPY run_multi-rx_service.sh /op25/op25/gr-op25_repeater/apps/run_multi-rx_service.sh +RUN chmod +x /op25/op25/gr-op25_repeater/apps/run_multi-rx_service.sh # Expose ports for HTTP control as needed, for example: EXPOSE 8001 8081 diff --git a/op25.liq b/op25.liq new file mode 100644 index 0000000..851df79 --- /dev/null +++ b/op25.liq @@ -0,0 +1,41 @@ +#!/usr/bin/liquidsoap + +# Example liquidsoap streaming from op25 to icecast +# (c) 2019-2021 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.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 2.5 -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) + +# Compression +input = compress(input, attack = 2.0, gain = 0.0, knee = 13.0, ratio = 2.0, release = 12.3, threshold = -18.0) + +# Normalization +input = normalize(input, gain_max = 6.0, gain_min = -6.0, target = -16.0, threshold = -65.0) + + +# 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, host="ic2.vpn.cusano.net", port=8000, mount="mountpoint", password="hackme", mean(input)) \ No newline at end of file diff --git a/run_multi-rx_service.sh b/run_multi-rx_service.sh new file mode 100644 index 0000000..4937480 --- /dev/null +++ b/run_multi-rx_service.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Configuration file path +CONFIG_FILE="/configs/active.cfg.json" + +# --- Start the main OP25 receiver (multi_rx.py) in the background --- +# The '&' sends the process to the background. +echo "Starting multi_rx.py..." +./multi_rx.py -v 1 -c $CONFIG_FILE & +MULTI_RX_PID=$! # Store the PID of the background process + +# --- Start the liquid-dsp plot utility (op25.liq) in the background --- +echo "Starting op25.liq..." +./op25.liq -c $CONFIG_FILE & +LIQ_PID=$! # Store the PID of the op25.liq process + +# Wait for both background jobs to finish. +# Since multi_rx.py is the core service, this script will effectively wait +# until multi_rx.py is externally stopped (via the API). +# The trap command ensures that SIGTERM is passed to the background jobs. +trap "kill $MULTI_RX_PID $LIQ_PID" SIGTERM SIGINT +wait $MULTI_RX_PID \ No newline at end of file