ARN and ARRL News on ASL3

Just in case there is interest among ASL3 users who would like to set up their nodes for audio news playback, I have been able to successfully get it working. Let me know if you would like for me to post it here. This uses the Hamvoip script that has been modified to be compatible with ASL3.

73,
Michael KE7MT

2 Likes

Yes please? I’m for sure interested.

Please do, would be interested as well.

73

Rob

I had created a .pdf file which did not paste too well, so I deleted that post and now trying again… sorry about that.

The Playnews script and accompanying files are set up for HamVOIP and will not work with ASL3 unless certain modifications are made.

  1. The ASL3 image does not include Lame, which is needed to convert the .mp3 audio format from ARN and ARRL to .wav files. First the script will download the .mp3 file from either ARN or ARRL, then it will convert the .mp3 file to a .wav file. It will then divide the .wav file into 2.5 minute segments so playback will not cause your node to timeout.
    Next, the script will use a utility called “sox” to convert the individual .wav files to ulaw, an audio format that the Raspberry Pi can use.
  2. The script points to the asterisk executable which is located in /usr/bin. The ASL3 asterisk executable is located in /usr/sbin.
  3. The playnews instructions direct you to navigate to /etc/asterisk/local. There is no /local subdirectory in /etc/asterisk.
  4. And finally, the playnews script includes a command to force a local ID of your node will it is preparing the files for transmission, for which the HamVOIP version uses /usr/bin/asterisk -rx “rpt fun $NODE *80”. Since the asterisk executable is located in /usr/sbin, and the status command for local ID is different, that part of the script will not work.

Here are the steps that I took to get everything to work in ASL3:

Log in to your server and use the terminal from the Web Admin Portal of the “cockpit” page, or use the ssh program of your choice to access the command line interface.
Then type sudo -s
Install lame:
apt-get install lame
(the sox program is already present in the ASL3 image- no need to do anything with it)
cd /etc/asterisk
mkdir local
chmod 775 local
cd local
mkdir playnews
chmod 755 playnews
cd playnews
wget http://hamvoip.org/downloads/playnews-0.11.tar.gz
tar xvzf playnews-0.11.tar.gz
This will create all the files in this (playnews) directory.
chmod 750 playnews-0.11
rm playnews-0.11.tar.gz
(We no longer need the tar.gz file, so it can be deleted)
The playnews script uses /tmp to store the audio files used for transmission, but when I tested the playback, I
found that the ARN news worked fine but ARRL news did not. It would begin with, “ARRL news will start now”, followed immediately by, “ARRL news will continue in 20 seconds”. After about 3 minutes of nothing, ARRL news would skip to the next file segment. I gave up trying to figure that problem out, but at the same time I found a way to create a ramdisk which keeps the script from placing the audio files on the microSD card anyway. The script downloads the news file, performs the conversions from mp3 to wav and then divided into 2.5 minute ulaw audio files that are played back. After the news broadcast ends the script will delete all those files. The constant writing and deleting of files will eventually take its toll on the microSD card.

To set up the ramdisk:
mkdir /etc/ramdisk
nano /etc/fstab
At the end of the file, type:
tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=200M 0 0
Save the file (ctrl-o) then exit (ctrl-x)
Reboot your node
You can check to see if the ramdisk was created by typing:
df -h |grep ramdisk
The response should look like this:
tmpfs 200M 0 200M 0% /mnt/ramdisk

The next step is to make some changes within the playnews-0.11 script in order to make this all work in ASL3.

cd /etc/asterisk/local/playnews
nano playnews-0.11
Scroll down to line #100 and change TMPDIR=“/tmp” to:
TMPDIR=“/mnt/ramdisk”
Change line #255 to:
/usr/sbin/asterisk -rx “rpt $MODE $NODE $TMPDIR/news”
Change line #262 to:
/usr/sbin/asterisk -rx “rpt $MODE $NODE $TMPDIR/news”
Change line #277 to:
/usr/sbin/asterisk -rx “rpt fun $NODE *711”
Change line #290 to:
/usr/sbin/asterisk -rx “rpt $MODE $NODE $TMPDIR/news”
Change line #301 to:
/usr/sbin/asterisk -rx “rpt $MODE $NODE $TMPDIR/news”
And finally, change line #308 to:
/usr/sbin/asterisk -rx “rpt $MODE $NODE $TMPDIR/news”
Save the file (ctrl-o) then exit (ctrl-x)
That’s all there is to it!

From WA3DSP:
You can run it either manually at the command line, set up a DTMF command to run it through a script or more
likely run it in a cron at a specific time.
Here are some examples -

Play Amateur Radio Newsline at 9 PM on Sunday (0 day) queue up at 8:30 PM

to node 40000 globally

30 20 * * 0 /etc/asterisk/local/playnews/playnews-0.11 ARN 21:00 40000

Play ARRL News at 9 PM on Monday (1 day) queue up at 8:30 PM

to node 40000 globally

30 20 * * 1 /etc/asterisk/local/playnews/playnews-0.11 ARRL 21:00 40000
Either of these could have an ‘L’ last parameter to play only locally.
To play right away, you would only do this manually.

Plays ARRL News NOW to node 40000 locally

/etc/asterisk/local/playnews/playnews-0.11 ARRL NOW 40000 L
When playing now it has a setup time to get and process the file and then you can hit any key to play.
So the basic command syntax would be -
/etc/asterisk/local/playnews/playnews-0.11 ARRL|ARN xx:xx|NOW L|G
G or global is assumed if no last parameter.
If you have any other questions let me know.
73 Doug
WA3DSP
WA3DSP Amateur Radio Resources http://www.crompton.com/hamradio

I made one change to the playnews.ini file which pulls the latest ARRL news sound file directly from ARRL HQ. This is due to the fact that sometimes holidays occur on a Friday, and ARRL does not have the latest news uploaded on that day. Sometimes they upload the Wednesday or Thursday before, and the .ini file directs the script to download the ARRL news dated with Friday’s date in the filename. This means that on those holiday Fridays, you won’t be getting the latest news because it was uploaded a day or two before, and do not contain Friday in the filname. By changing the ARRL-URL line, the script will be directed to download the latest news sound file regardless of its date.

cd /etc/asterisk/local/playnews
nano playnews.ini
Under the # Set to ARRL URL, put a # in front of
ARRL_URL=“http://content.blubrry.com/arrlaudionews/AAN-$(date --date=“last friday” +%Y-%m-%d).mp3”
(You could choose to delete that line entirely and simply replace it, but if for some reason ARRL changes the following URL in the future, it will cause a problem!)
And add the following line below it:
ARRL_URL=“https://www.arrl.org/files/file/News/Audio%20News/AudioNews-Latest.mp3”
This is what playnews.ini should look like:
#!/bin/bash

CAUTION

This file is require to provide URL’s to the main playnews script

Set these URLs carefully. If not set correctly playnews will

not work.

SET to Amateur Radio Newslines URL

ARN_URL=“https://www.arnewsline.org/s/news.mp3”

Set to ARRL URL

ARRL_URL=“http://content.blubrry.com/arrlaudionews/AAN-$(date --date=“last friday” +%Y-%m-%d).mp3”

ARRL_URL=“https://www.arrl.org/files/file/News/Audio%20News/AudioNews-Latest.mp3”

Howdy,

Thanks forthis. I’m saving this email for sure and will definitely be making the necessary mods to the script. Thanks for documenting your work and also for posting directly to the reflector.

Vy 73, de KB5ELV

Anyone know if any of the ARRL news playback utilities that are available actually parse the audio based on the break tones that are present or do all of them break on arbitrary times (e.g. 2.5 minutes)?

There is forthcoming code for ASL3 for commands asl-play-arn and asl-play-arrlnews that will play those seamlessly. Code asl-play-arn is my code that I’m donating to ASL and adding the ARRL news feed. Right now, you just disable TOTs before playing and renable them after. I’d like to split the files up but there isn’t a clean programmatic way to do it on a break.

When researching this earlier today I came across the utility mp3splt. Using 3 seconds and -30db threshold as the amount to split on, it split the news.mp3 file perfectly.

mp3splt -s -p th=-30,min=3 news.mp3

I am hoping to come up with a smarter way that looks for audio silence before the 10 minute mark and split it there.

You can probably split at silence before the 10 minute mark, but considering most simplex nodes have 3 or 5 minute timers (repeaters are perhaps different), that isn’t necessarily a great one-stop solution, either.
You could disable the timers on your own local node before playing ARN, I guess.

For years, I’ve been running ARN on my system where the files are split logically. Unfortunately, this means some manual editing for me, usually takes about five minutes a week. I plan to eventually offer this as a dial-on-demand node where up to ten (maybe more) simultaneous callers will get their own feed, complete with some processing and trimming, and no bridging, and another version where it just plays straight through. I have found that adding some equalization and limiting in key places helps to make it more intelligible over small radios and speakers. I even sometimes process some of the individual presenters separately.
Unfortunately, none of this is programmatic, which is why I want to make it available as a service for those who want that.

Great to hear, and thank you! This gave me a chance to gain some experience with scripts, and how they work. None of the info was my own- I merely took others’ creations and figured out what to change.
ASL3 is working very well on my duplex node- the audio is so much better than the Hamvoip software I had been using.

~Michael KE7MT

thanks for this. noting this is for the PI version will it work on a debian 12 cloud install?

It’s part of the asl3 package which is not Pi-specific.

Is the Play news part of the current one? Or still to come?

if current, what is the command?

I tried this allstar-play-arn --node 620300

It was from root, but I got Command not found. :slight_smile:

too soon?

Rob - K6IRK

@N8EI, I’ve developed a script as well for ARN & ARRL Audio News that takes greater pains at normalizing and companding the audio so that the audio is stable and sounds good, especially through automated nodes (and other VoIP circuits). Week by week, the audio ARN releases is little more than hot garbage. ARRL is a little better, but they still push the envelope.

If it meets your curiosity, I could submit some script samples and see if they can be worked into your feature. They’re Bash…I was never really good with Python but I imagine the command switches are similar.

Carl/K6CRS

asl-play-arn was contained in the asl3-3.3.0 package that was released to production ~ 10 days ago.

Also: asl-play-arn - AllStarLink Manual

Any code contribution that is original, has clean origin (i.e. not taken out of other linking systems’ code), and is willing to be contributed under the GPLv3 is welcome. A GitHub gist is the best way.

I tried it and get this

Trebor57@node620300:/usr/share/asl3 $ asl-play-arn --node 620300
Error: unsupported format string passed to list.format
Trebor57@node620300:/usr/share/asl3 $

Ok, had to run it as root, but nothing playing and no error:

root@node620300:/usr/share/asl3# asl-play-arn --node 620300 --debug
play-arn: main: DEBUG: MP3_OUT: /tmp/tmp44rbg81f.mp3
play-arn: main: DEBUG: WAV_OUT: /tmp/tmpjqc2tajr.wav
play-arn: main: DEBUG: UL_OUT: /tmp/tmphh9zod1q.ul
play-arn: main: DEBUG: Convert MP3 to WAV: lame -h -S --decode /tmp/tmp44rbg81f.mp3 /tmp/tmpjqc2tajr.wav
play-arn: main: DEBUG: Convert WAV to ULAW: sox -v 0.7 /tmp/tmpjqc2tajr.wav -r 8k -c 1 -t ul /tmp/tmphh9zod1q.ul
play-arn: main: DEBUG: Play Asterisk: [‘asterisk’, ‘-rx’, ‘rpt playback 620300 /tmp/tmphh9zod1q’]
play-arn: main: DEBUG: sleeping for 15 seconds for playback to start
root@node620300:/usr/share/asl3#

I noticed this in the docs:

DESCRIPTION

Basic use is either immediately from the command line:

allstar-play-arn --node 1999

Should it not be asl-play-arn instead of allstar-play-arn

One minor spelling error too

Sceheduling :slight_smile:

I know it happens.

@N8EI: I may have pilfered the original concept, but the code is mine (with some help from Stack Exchange and ChatGPT). My only intention is to convey some importance to the concept of audio treatment when the source material varies wildly from week to week. These scripts run weekly and can be heard on Hamshack Hotline (ext 7008) and Hams over IP (ext 100098, option 3) so you can hear the results for yourself.

The scripts are fairly well commented and it’s obvious where ffmpeg-normalize and sox are brought in to treat and convert, as well as the flags used.

AR Newsline:

ARRL Audio News:

I hope it can be of some use. I also have some for RSGB, WIA and This Week in Amateur Radio’s truncated 1 hour broadcast, but they are more involved because you have to pull from podcast aggregators.

73,

Carl/K6CRS