diff --git a/SkyControl.py b/SkyControl.py index 020ef3c..d684fb2 100644 --- a/SkyControl.py +++ b/SkyControl.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkyControl.py v0.6.1 by Mason Nelson +SkyControl.py v0.6.2 by Mason Nelson ================================== A Control Script for SkywarnPlus diff --git a/SkyDescribe.py b/SkyDescribe.py index 8e5d273..96721f8 100644 --- a/SkyDescribe.py +++ b/SkyDescribe.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkyDescribe.py v0.6.1 by Mason Nelson +SkyDescribe.py v0.6.2 by Mason Nelson ================================================== Text to Speech conversion for Weather Descriptions diff --git a/SkywarnPlus.py b/SkywarnPlus.py index e605297..eb3b3b6 100644 --- a/SkywarnPlus.py +++ b/SkywarnPlus.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 """ -SkywarnPlus.py v0.6.1 by Mason Nelson +SkywarnPlus.py v0.6.2 by Mason Nelson =============================================================================== SkywarnPlus is a utility that retrieves severe weather alerts from the National Weather Service and integrates these alerts with an Asterisk/app_rpt based @@ -927,29 +927,35 @@ def say_allclear(): # Generate silence for spacing between sounds silence = AudioSegment.silent(duration=600) # 600 ms of silence - # Combine the sound clips + # Combine the "all clear" sound and SWP_147 sound with the configured silence between them combined_sound = all_clear_sound + silence + swp_147_sound # Add a delay before the sound if configured if AUDIO_DELAY > 0: LOGGER.debug("sayAllClear: Prepending audio with %sms of silence", AUDIO_DELAY) - silence = AudioSegment.silent(duration=AUDIO_DELAY) - combined_sound = silence + combined_sound - - # Export the combined sound to a file - all_clear_file = os.path.join(TMP_DIR, "allclear.wav") - converted_combined_sound = convert_audio(combined_sound) - converted_combined_sound.export(all_clear_file, format="wav") + delay_silence = AudioSegment.silent(duration=AUDIO_DELAY) + combined_sound = delay_silence + combined_sound # Append a suffix to the sound if configured if config.get("Alerting", {}).get("SayAllClearSuffix", None) is not None: + suffix_silence = AudioSegment.silent( + duration=600 + ) # 600ms silence before the suffix suffix_file = os.path.join( SOUNDS_PATH, config.get("Alerting", {}).get("SayAllClearSuffix") ) LOGGER.debug("sayAllClear: Adding all clear suffix %s", suffix_file) suffix_sound = AudioSegment.from_wav(suffix_file) - converted_suffix_sound = convert_audio(suffix_sound) - converted_suffix_sound.export(all_clear_file, format="wav") + combined_sound += ( + suffix_silence + suffix_sound + ) # Append the silence and then the suffix to the combined sound + + # Now, convert the final combined sound + converted_combined_sound = convert_audio(combined_sound) + + # Export the final converted sound to a file + all_clear_file = os.path.join(TMP_DIR, "allclear.wav") + converted_combined_sound.export(all_clear_file, format="wav") # Play the "all clear" sound on the configured Asterisk nodes node_numbers = config.get("Asterisk", {}).get("Nodes", []) @@ -1095,13 +1101,13 @@ def build_tailmessage(alerts): suffix_file = os.path.join(SOUNDS_PATH, tailmessage_suffix) suffix_sound = AudioSegment.from_wav(suffix_file) combined_sound += suffix_silence + suffix_sound - else: - if AUDIO_DELAY > 0: - LOGGER.debug( - "buildTailMessage: Prepending audio with %sms of silence", AUDIO_DELAY - ) - silence = AudioSegment.silent(duration=AUDIO_DELAY) - combined_sound = silence + combined_sound + + if AUDIO_DELAY > 0: + LOGGER.debug( + "buildTailMessage: Prepending audio with %sms of silence", AUDIO_DELAY + ) + silence = AudioSegment.silent(duration=AUDIO_DELAY) + combined_sound = silence + combined_sound converted_combined_sound = convert_audio(combined_sound) LOGGER.info("Built new tailmessage") diff --git a/config.yaml b/config.yaml index 769ae2e..fd540e3 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,4 @@ -# SkywarnPlus v0.6.1 Configuration File +# SkywarnPlus v0.6.2 Configuration File # Author: Mason Nelson (N5LSN/WRKF394) # Please edit this file according to your specific requirements.