From 5db13d99ca83f2316283fb20c177c58849a3cabf Mon Sep 17 00:00:00 2001 From: Jeremy Noesen Date: Thu, 10 Oct 2024 20:37:54 -0500 Subject: [PATCH] add silence to ambiance mix --- README.md | 2 +- main.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 595b6f1..2fa23e4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Saul opening will be chosen as a callback to the original AI Sponge. The available sound effects are steel sting, boowomp, vibe link (b), disgusting fog horn, "My leg!", "Oh brother this guy stinks!", "You what?", and the dolphin censor sound. One of these is chosen at random to play at a random point per episode. Every episode begins with the bubbles transition sound. Every episode also has background ambiance that can be -either underwater sounds or night crickets, with a chance of rain sounds on top of that. +underwater sounds night crickets, or silence, with a chance of rain sounds on top of that. ### Random Events diff --git a/main.py b/main.py index c759e01..e48a927 100644 --- a/main.py +++ b/main.py @@ -169,11 +169,14 @@ async def generate(inter: discord.Interaction, topic: str) -> None: music_loop = silence_music.append(music.fade_in(10000), 0) while len(music_loop) < len(combined): music_loop = music_loop.append(music, 0) - ambiance = random.choice([sfx_day, sfx_night]) - ambiance_loop = ambiance - while len(ambiance_loop) < len(combined): - ambiance_loop = ambiance_loop.append(ambiance, 0) - if random.randrange(4) > 0: + if random.randrange(3) > 0: + ambiance = random.choice([ambiance_day, ambiance_night]) + ambiance_loop = ambiance + while len(ambiance_loop) < len(combined): + ambiance_loop = ambiance_loop.append(ambiance, 0) + else: + ambiance_loop = AudioSegment.empty() + if random.randrange(5) > 0: rain_loop = AudioSegment.empty() else: rain_loop = ambiance_rain