How to capture and post NOAA Weather Radio alerts
(In five not very easy steps!)
(Another donateWare script from MRE Software)


On my weather site I have a NOAA Weather Radio (NWR) player that works in conjunction with Weather USA to offer the audio of NWR Station KEC61 in Mobile, AL via the web.  This means I have a home computer that is receiving the station and continuously uploading the audio to their Icecast server.  Being in a coastal area, along with the normal weather alerts we also receive a lot of marine warnings.  For a long time I had envisioned capturing these voice alerts and making them available for mariners and others to listen to later in the event that they missed the original broadcast.  This page outlines the project and offers some sample code.

(1.) The first thing you need is a receiver for the off-air NWR radio station.  In my case I am using a Software Defined Radio dongle but any receiver capable of tuning the NWR station and feeding it into your computer sound card will work.  A strong, clear signal is preferred.

(2.) The next thing you need is software to decode the digital alerts sent out over NWR.  I found a program called SeaTTY from DXsoft.  Basically you feed the NWR audio stream to SeaTTY and it monitors it for the digital signature of an NWR-SAME alert message.  When it detects one it saves a .TXT file that contains the alert type, and SAME codes for the counties the alert covers.  The filename is the time the alert was issued. 230719-143053.TXT would be a typical filename as year, month, day, hyphen, hour, minutes, seconds.  All with leading zeros and time in 24 hour format.  SeaTTY also saves a matching WAV file by the same name that contains the captured audio.  A note here: SeaTTY is shareware.  You can test it out for free but in order to save your settings you will eventually need to register.  I encourage you to do so in the event that you go on to use it!

(3.) Now you need a way to upload the files to your web server.  I used the popular WinSCP SFTP client and FTP client for Microsoft Windows.  This software has some great automation features using its own scripting engine.  I setup a Windows task to execute every 5 minutes and run a batch file that deletes old files, then instructs WinSCP to synchronize a web server folder with the corresponding local folder.  This automatically keeps the local and web server files in sync and cleans up the older alerts from both locations.  That batch file is as follows;
REM Remove files older than 2 days
forfiles /p "C:\ProgramData\SeaTTY\Messages" /s /d -2 /c "cmd /c del @file : date >= 2 days >NUL"
forfiles /p "C:\ProgramData\SeaTTY\Raw_Logs" /s /d -2 /c "cmd /c del @file : date >= 2 days >NUL"
REM Run the WinSCP script to sync local files to the server
cd C:\Program Files (x86)\WinSCP /script=C:\ProgramData\SeaTTY\upload_script.txt
REM timeout /t 60

Note that the batch file runs a WinSCP script named upload_script.txt that I placed in the C:\ProgramData\SeaTTY\ folder.  That script file appears below:
synchronize remote -delete C:\ProgramData\SeaTTY\Messages /NOAA/Messages

You may need to adjust the folder paths in these scripts for your particular setup but hopefully the commands will be helpful.  It took some experimentation to get it all to work.  For reference I named the folder on my web server ../NOAA/messages.  That file path is used in all of these scripts.  If you don't like it, change it as desired.

(4.) Now that you have SeaTTY capturing alerts and WinSCP posting them to your web server, you will need a way to display them on your page.  I have written a PHP script that does that job.  I named it: NOAA_radio_js.php.  You call it as a JavaScript and it returns a document.write() statement.
Example usage in html page: <script type="text/javascript" src="NOAA_radio_js.php"></script>

NOTES: This script contains county and marine SAME codes that are associated with NWR station KEC61 in Mobile, AL.  It will work for all NWR stations but unless the county code is contained in the $county_array Array the program will just print the code number and not the text name.  The user will need to modify the $county_array for the area covered by the station they are monitoring.  You can find a list of the counties covered by your NWR station here: and you find marine codes here: The $code_array Array is the generic 3 letter NOAA alert codes and textual names.  It should be fine as is unless NOAA decides to add some new ones.

(5.) Finally, you need a player page to load the file.  The audio has a very annoying 15 seconds of digital trash and alarm tone at the very beginning.  In order to skip this I created a very simple html page the load an audio player and start playing at 15 seconds.  The file should be named NWR_audio_player.htm and placed with your other html files.  If you place it on a different path you will need to adjust the links generated near the bottom of the php script.  The html code of this page is below:

<!DOCTYPE html>
<meta content="simple audio player" name="description">
<title>NWR audio Player</title>
<body style="background-color: #DDDDDD">
<table align="center" style="border: 2px solid #006600; background-color: #C0C0C0;" cellpadding="2" cellspacing="4">
<td style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #006600">
<strong><em> - NWR Audio Player</em></strong></td>
<audio id="myAudio" autoplay controls style="width: 400px">
<td style="text-align: center">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 16px">Audio is set to start at 15 seconds to skip the alert tones.<br/></span>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 14px">Press the play button if the audio does not start automatically.</span>
const urlParams = new URLSearchParams(;
const wavSRC = urlParams.get('wav');
var x = document.getElementById("myAudio");
x.src = wavSRC+"#t=00:00:15";
x.volume = 0.3;

If you find this code of value, donate a little to the cause.  Think of the time you just saved!

Questions / Comments?  Email me.

MRE Logo