A Fast Python EAS Generation Library
Features
- EAS Generation
- Individual Header, Attention Tone, and EOM Generation
- Fast
- PyDub AudioSegment Output for Easy Integration
- Audio File Input for Audio Injection
Installation
This package should be installable through Pip.
On a Debian Based Linux OS:
sudo apt update
sudo apt install python3 python3-pip
pip3 install EASGen
On Windows:
In CMD:
python -m pip install EASGen
Usage
To generate a simple SAME Required Weekly Test:
from EASGen import EASGen
from pydub.playback import play
header = "ZCZC-EAS-RWT-005007+0015-0010000-WACNTECH-" ## EAS Header to send
Alert = EASGen.genEAS(header=header, attentionTone=False, endOfMessage=True) ## Generate an EAS SAME message with no ATTN signal, and with EOMs.
play(Alert) ## Play the EAS Message
To Insert Audio into an alert:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
header = "ZCZC-CIV-DMO-033000+0100-0010000-WACNTECH-" ## EAS Header to send
audio = AudioSegment.from_wav("NewHampshireDMO.wav") ## Alert Audio import
Alert = EASGen.genEAS(header=header, attentionTone=True, audio=audio, endOfMessage=True) ## Generate an EAS SAME message with an ATTN signal, the imported WAV file as the audio, and with EOMs.
play(Alert) ## Play the EAS Message
## The New Hampshire State Police has activated the New Hampshire Emergency Alert System in order to conduct a practice demo. This concludes this test of the New Hampshire Emergency Alert System.
Spamming New Hampshire Demos have never been easier!
For a custom SampleRate:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
header = "ZCZC-EAS-DMO-055079+0100-0010000-WACNTECH-" ## EAS Header to send
Alert = EASGen.genEAS(header=header, attentionTone=True, endOfMessage=True, SampleRate=48000) ## Generate an EAS SAME message with an ATTN signal, the imported WAV file as the audio, with EOMs, at a samplerate of 48KHz.
play(Alert) ## Play the EAS Message
To export an alert instead of playing it back:
from EASGen import EASGen
from pydub import AudioSegment
header = "ZCZC-EAS-RWT-055079+0100-0010000-WACNTECH-" ## EAS Header to send
Alert = EASGen.genEAS(header=header, attentionTone=True, endOfMessage=True, SampleRate=48000) ## Generate an EAS SAME message with an ATTN signal, the imported WAV file as the audio, and with EOMs.
EASGen.export_wav("Alert.wav", Alert)
To resample an alert after generation (If SampleRate is making the audio weird):
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
header = "ZCZC-EAS-DMO-055079+0100-0010000-WACNTECH-" ## EAS Header to send
Alert = EASGen.genEAS(header=header, attentionTone=True, endOfMessage=True) ## Generate an EAS SAME message with an ATTN signal, the imported WAV file as the audio, and with EOMs.
Alert = Alert.set_frame_rate(8000) ## Resample the alert to 8KHz for no reason lol.
play(Alert) ## Play the EAS Message
To simulate an ENDEC type:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
header = "ZCZC-CIV-DMO-033000+0100-0010000-WACNTECH-" ## EAS Header to send
audio = AudioSegment.from_wav("NewHampshireDMO.wav") ## Alert Audio import
Alert = EASGen.genEAS(header=header, attentionTone=True, audio=audio, mode="DIGITAL", endOfMessage=True) ## Generate an EAS SAME message with an ATTN signal, the imported WAV file as the audio, with EOMs, and with a SAGE DIGITAL ENDEC style.
play(Alert) ## Play the EAS Message
## The New Hampshire State Police has activated the New Hampshire Emergency Alert System in order to conduct a practice demo. This concludes this test of the New Hampshire Emergency Alert System.
Now you can make all the Mocks you want!
Supported ENDECS:
- None
- TFT (Resample to 8KHZ using ".set_frame_rate(8000)" on the generated alert)
- EASyCAP (Basically the same as None)
- DASDEC (Crank up the Samplerate to 48000 for this one)
- SAGE EAS ENDEC (Mode = "SAGE")
- SAGE DIGITAL ENDEC (Mode = "DIGITAL")
- Trilithic EASyPLUS/CAST/IPTV (Mode = "TRILITHIC")
- NWS (Mode = "NWS", Resample to 11KHZ using ".set_frame_rate(11025)" on the generated alert)
Unsupported ENDECS:
- HollyAnne Units (Can't sample down to 5KHz... This is a good thing.)
- Gorman-Reidlich Units (Don't listen to them enough to simulate. I think they're like TFT, but donno.)
- Cadco Twister Units (No Data)
- MTS Units (No Data)
To hear all the ENDEC styles, Do this:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
print("Normal / EASyCAP")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "", 24000))
print("DAS")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "", 48000))
print("TFT")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "", 24000).set_frame_rate(8000))
print("NWS")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "NWS", 24000).set_frame_rate(11025))
print("SAGE")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "SAGE", 24000))
print("DIGITAL")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "DIGITAL", 24000))
print("EASyPLUS/CAST/IPTV")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-WACN -", True, True, AudioSegment.empty(), "TRILITHIC", 24000))
NEW:
Added WEA and NPAS Modes:
For NPAS:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
Alert = EASGen.genEAS(mode="NPAS") ## Generate an NPAS (AlertReady) Tone
play(Alert) ## Play the NPAS Tones
For WEA:
from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment
Alert = EASGen.genEAS(mode="WEA") ## Generate WEA Tones
play(Alert) ## Play the WEA Tones
Hope you enjoy!
Release files for EASGen 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| EASGen-0.1.9.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| EASGen-0.1.9-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 27.8 kB
Release files / EASGen-0.1.9.tar.gz
| Download URL | EASGen-0.1.9.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d37ecf97e36d5bdfe8e31a49d9c8c2fec043d98fea84474e2c14654e0b112138
|
|
BLAKE2b-256 checksum How to use checksums |
12ee555f5aed82a660ae283189ecccb20e231d730f9315d36a57a2247c105044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / EASGen-0.1.9-py2.py3-none-any.whl
| Download URL | EASGen-0.1.9-py2.py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
203c956c59fab8d9adf25a0ec6518300d63a814d355d7dcc0bbbd7d2e9dad0fb
|
|
BLAKE2b-256 checksum How to use checksums |
8c3955777cb67c4ce41ce40eb11751a7e6a3356963d0235628f3981d6f30ecc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|