JTK – Notes and Ramblings Things we have found …

12/26/2025

Yet another Pi Weather Radio update

Filed under: General — taing @ 6:01 pm

After an update to Raspberry Pi OS Trixie and a great deal of hassle with sox not being willing to handle mp3 format in spite of libsox-fmt-mp3 being installed the Weather Radio scripts have been updated again.

The start.sh script is unaltered from before:

cd weatherRadio
rm -f one two three; mkfifo one two three

./to-same.sh <one &
./to-lame.sh <two &
./to-udp.sh <three &
rtl_fm -f 162550000 -s 22050 -p 14 | tee one two three |multimon-ng -t raw -a EAS /dev/stdin

The tosame.sh script is also unaltered:

multimon-ng -t raw -a EAS /dev/stdin | python3 ~/tg-dsame/dsame.py --mqtt your-mqtt-broker --json output.json --call /home/pi/weatherRadio/playRadio.sh --command boo

The to-lame.sh script was updated to once again use lame instead of sox for the mp3 conversion. While ez-stream can handle other formats mp3 works well from lame.

lame --bitwidth 16 --signed -s 22050 --lowpass 3500 --abr 64 --scale 8 -r -m m - - |ezstream -c ezstream.conf

The to-udp.sh script was greatly simplfied and sox was removed completely from it:

socat -u - udp4-sendto:localhost:5555

The playRadio.sh script was updated to handle playing a raw stream instead of mp3:

#!/bin/bash
nc -lu 5555|play -t raw -r 22050 -b 16 -e signed -c 1 -v 7 -&amp;
sleep 120
killall "play"

For completeness, the ezstream.conf file:

<?xml version="1.0" encoding="UTF-8"?>
<ezstream>

  <servers>
    <server>
      <protocol>http</protocol>
      <hostname>somemachine</hostname>
      <password>hackmeplease</password>
    </server>
  </servers>

  <streams>
    <stream>
      <mountpoint>/weather</mountpoint>
      <format>MP3</format>
      <stream_name>The Weather Radio</stream_name>
      <stream_url>yoururl</stream_url>
      <stream_genre>weather</stream_genre>
      <stream_description>NOAA Radio KHB59 (162.55MHz)</stream_description>
      <stream_quality>2.0</stream_quality>
      <stream_bitrate>32</stream_bitrate>
      <stream_samplerate>48000</stream_samplerate>
      <stream_channels>1</stream_channels>
    </stream>
  </streams>

  <intakes>
    <intake>
      <type>stdin</type>
      <stream_once>yes</stream_once>
    </intake>
  </intakes>
</ezstream>

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress