Skip to main content

A Python library to generate EAS SAME Audio using Raw Data - Remastered

Project description

🌩️ EASGen: A Fast Python EAS Generation Library

EASGen

EASGen is a powerful Python library for translating EAS (Emergency Alert System) ZCZC strings or other data into SAME (Specific Area Messaging) headers. It includes robust support for individual headers, attention tones, EOM generation, emulation modes, and WEA tone generation, ensuring a seamless experience for encoding emergency messages.


🛠️ Features

  • EAS Generation: Converts raw ZCZC SAME strings into Individual headers, attention tones. Also allows generation of EOMs.
  • PyDub AudioSegment Output: Provides easy integration through PyDub AudioSegments.
  • Audio File Input: Allows for audio files to be input to allow for audio messages and other forms of audio injection.
  • Very Quick: Generates headers quickly and efficiently, allowing for high performance usage.
  • Emulation Modes: Mimic the sound of various EAS hardware/software systems.

🚀 Installation

Linux (Debian-based)

sudo apt update
sudo apt install python3 python3-pip
python3 -m pip install EASGen-Remastered

Windows

  1. Install Python.
  2. Open CMD and run:
    python -m pip install EASGen-Remastered
    

📖 Basic Usage

Generate a simple SAME Required Weekly Test:

from EASGen import EASGen
from pydub.playback import play

header = "ZCZC-EAS-RWT-005007+0015-0010000-EAR/FOLF-" ## 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
Output Your browser does not support the audio tag.

🔍 Advanced Usage

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-EAR/FOLF-" ## 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.
Output Your browser does not support the audio tag.

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-EAR/FOLF-" ## 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
Output Your browser does not support the audio tag.

To export an alert instead of playing it back:

from EASGen import EASGen
from pydub import AudioSegment

header = "ZCZC-EAS-RWT-055079+0100-0010000-EAR/FOLF-" ## 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)
Output Your browser does not support the audio tag.

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-EAR/FOLF-" ## 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
Output Your browser does not support the audio tag.

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-EAR/FOLF-" ## 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.
Output Your browser does not support the audio tag.

Now you can make all the Mocks you want!

Supported ENDECS:

  • [x] None
  • [x] TFT (Resample to 8KHZ using ".set_frame_rate(8000)" on the generated alert)
  • [x] EASyCAP (Basically the same as None)
  • [x] DASDEC (Crank up the Samplerate to 48000 for this one)
  • [x] SAGE EAS ENDEC (Mode = "SAGE")
  • [x] SAGE DIGITAL ENDEC (Mode = "DIGITAL")
  • [x] Trilithic EASyPLUS/CAST/IPTV (Mode = "TRILITHIC")
  • [x] 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-EAR/FOLF-", True, True, AudioSegment.empty(), "", 24000, False))
print("DAS")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "", 48000, True))
print("TFT")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "", 24000, True).set_frame_rate(8000))
print("NWS")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "NWS", 24000, True).set_frame_rate(11025))
print("SAGE")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "SAGE", 24000, True))
print("DIGITAL")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "DIGITAL", 24000, True))
print("EASyPLUS/CAST/IPTV")
play(EASGen.genEAS("ZCZC-EAS-DMO-055079+0100-0391810-EAR/FOLF-", True, True, AudioSegment.empty(), "TRILITHIC", 24000, True))
Output Your browser does not support the audio tag. Your browser does not support the audio tag. Your browser does not support the audio tag. Your browser does not support the audio tag. Your browser does not support the audio tag. Your browser does not support the audio tag. Your browser does not support the audio tag.

To generate ATTN only alerts, such as NPAS or WEA:

For NPAS:

from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment

Alert = EASGen.genATTN(mode="NPAS") ## Generate an NPAS (AlertReady) Tone
play(Alert) ## Play the NPAS Tones
Output Your browser does not support the audio tag.

For WEA:

from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment

Alert = EASGen.genATTN(mode="WEA") ## Generate WEA Tones
play(Alert) ## Play the WEA Tones
Output Your browser does not support the audio tag.

To use the Bandpass Filter functionality:

from EASGen import EASGen
from pydub.playback import play
from pydub import AudioSegment

header = "ZCZC-CIV-DMO-033000+0100-0010000-EAR/FOLF-" ## EAS Header to send
Alert = EASGen.genEAS(header=header, attentionTone=True, mode="DIGITAL", endOfMessage=True, bandpass=True) # New BandPass feature, which improves the audio quality on some emulation modes.
play(Alert) ## Play the EAS Message
Output Your browser does not support the audio tag.

⚠️ Reporting Issues

  • Bugs and other issues can be reported on Discord or in the GitHub Issues tab.
  • Include entire ZCZC SAME strings and any Audio Files injected and details for accurate and quick fixes.

📜 License

MIT License


👤 Contact

  • Developer: SecludedHusky Systems/Newton Communications
  • Discord: Contact Here

❤️ Thank You for Using My Version of EASGen!

Powered by SecludedHusky Systems. Get affordable internet radio services and VPS hosting today.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easgen_remastered-0.1.13.3.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easgen_remastered-0.1.13.3-py2.py3-none-any.whl (14.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file easgen_remastered-0.1.13.3.tar.gz.

File metadata

  • Download URL: easgen_remastered-0.1.13.3.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.1

File hashes

Hashes for easgen_remastered-0.1.13.3.tar.gz
Algorithm Hash digest
SHA256 ef224484f983c9b19ba9c8321fc694dc91960c921050fd3db692b8db81605ba3
MD5 37a382bfd878825c16e744cb6f395927
BLAKE2b-256 31139045b4c0e754f5be678100528f0aa024746fbec219b02a3e1c64587c529b

See more details on using hashes here.

File details

Details for the file easgen_remastered-0.1.13.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for easgen_remastered-0.1.13.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2a37f91cf96a6fd7ceb587c37df07e8bf95eb969caa46bb7e3dc02b7ceb83bda
MD5 f828a71af76252c718fb7a14ddd17641
BLAKE2b-256 5388362f2d995c0780ea1d32ac4209721d543b5a99cfa565579d15732d592bed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page