AudioEffectNotchFilter in Godot – Complete Guide

Welcome to this fantastic journey into the world of audio effects in game development using the Godot engine! Ever considered how a simple audio effect can drastically enhance a player’s gaming experience? Audio effects are not just about adding sound; they’re about sculpting the sonic environment to match the action on the screen. One such versatile effect is the AudioEffectNotchFilter. This tool can work wonders in fine-tuning your game’s audio experience. Whether you’re at the start of your coding journey or an experienced developer, this tutorial will provide a clear understanding of the notch filter and its applications in Godot 4 and why mastering it is beneficial for your game development skills.

What is AudioEffectNotchFilter?

The AudioEffectNotchFilter is a specialized class within the Godot 4 engine. It’s an effect implemented under the vast umbrella of audio processing tools provided by this powerful game engine. The notch filter works by attenuating frequencies in a tight bandwidth around a set cutoff point, thereby leaving the surrounding frequencies untouched. This specificity can enhance or diminish particular sounds within your game, adding depth and nuance to the auditory experience.

What is it For?

In game sound design, the AudioEffectNotchFilter can be crucial in refining the overall soundscape. It can be used to reduce unwanted frequencies that may be interfering with dialogue clarity or to minimize the presence of a bothersome sound that occurs at a specific frequency. The practical applications range from creating mysterious atmospheres to ensuring clear communication in gameplay.

Why Should I Learn It?

Sound can be as crucial as visuals when it comes to player immersion. Learning to use Godot’s AudioEffectNotchFilter means you’ll be able to control and perfect your game’s auditory environment with precision. This control is an invaluable skill, allowing you to craft an aural landscape as meticulous and immersive as the game world itself. With the notch filter, you’re not just creating sound; you’re sculpting it to enhance gamers’ experience, potentially making your game more memorable and engaging.

CTA Small Image

Creating an AudioEffectNotchFilter in Godot

To begin using the AudioEffectNotchFilter in Godot, we must first create an instance and assign it to an AudioBus. Here’s how you can do this from the Godot editor:

  1. Open your Godot project and navigate to the Audio tab.
  2. Here, you will find a list of Audio Buses. Select the bus you want to apply the filter to.
  3. Click on the ‘Add Effect’ button and select AudioEffectNotchFilter from the list.

Alternatively, you can create an AudioEffectNotchFilter through GDScript:

var notch_filter =
AudioServer.add_bus_effect(0, notch_filter)

This simple script creates a new instance of the AudioEffectNotchFilter and adds it to the first Audio Bus.

Configuring the Notch Filter Parameters

Now that we have our AudioEffectNotchFilter created, the next step is to configure its parameters to fit our needs. There are a few key properties that you can adjust:

  • cutoff_hz: The center frequency where the notch is applied.
  • bandwidth_hz: The range of frequencies around the cutoff frequency that will be affected.
  • gain: Controls the level of the frequencies that pass through the filter.

Here’s how you can set these parameters using GDScript:

notch_filter.cutoff_hz = 1000 # Cuts off frequencies at 1000Hz
notch_filter.bandwidth_hz = 100 # Sets the bandwidth to 100Hz around the cutoff frequency
notch_filter.gain = 6 # Increases the volume of the filtered frequencies by 6dB

Applying the Notch Filter to Game Sounds

With the filter now configured, it’s time to apply it to game sounds. To attach the filter to a particular sound, you must ensure the sound is being sent to the Audio Bus where the filter is applied.

Here’s how to set the Audio Bus on an AudioStreamPlayer node to use our filter:

var audio_player =
audio_player.bus = "Master" # Assuming the filter is on the Master bus
# Add the AudioStreamPlayer to the scene tree and play the audio
get_tree().root.add_child(audio_player) = preload("res://your_audio_file.ogg")

When the sound plays, it will be processed through the Master bus, and the notch filter effect will be applied.

Testing and Fine-Tuning

After applying the filter to your sounds, testing and fine-tuning are essential. You may need to adjust the parameters based on the game audio and the effect you’re aiming for. You can manipulate the properties in real-time to hear the changes immediately.

Here’s an example of how to adjust the cutoff frequency in real-time:

func _process(delta):
    # This is the range the cutoff frequency will vary in
    var min_freq = 500
    var max_freq = 1500
    # Oscillate the cutoff frequency for testing
    var t = OS.get_ticks_msec() % 1000 / 1000.0
    var cutoff_freq = min_freq + t * (max_freq - min_freq)
    notch_filter.cutoff_hz = cutoff_freq

This script will modify the cutoff frequency of the notch filter over time, oscillating between 500Hz and 1500Hz, allowing you to hear the filter’s effect on your game sound dynamically.

We’ve covered the basics of setting up and configuring the AudioEffectNotchFilter. It’s now time to experiment with your game’s audio. Remember, the key to mastering audio effects is to try different settings, listen carefully, and adjust as necessary. In the next part, we will delve into more advanced usage and creative applications of the notch filter.

Let’s delve deeper into advanced applications of the AudioEffectNotchFilter. Below, you’ll find practical examples illustrating how to utilize this powerful tool to create unique sound experiences in your games.

Dynamic Frequency Filtering

One creative use of the Notch Filter is to control it dynamically with gameplay events. For instance, we can create a script that changes the notch frequency based on the player’s speed:

func _on_player_speed_changed(speed):
    var min_freq = 200
    var max_freq = 5000
    var cutoff_freq = min_freq + speed / max_speed * (max_freq - min_freq)
    notch_filter.cutoff_hz = cutoff_freq

This code adjusts the cutoff frequency of the filter based on the player’s speed, adding a sense of velocity to the soundscape.

Procedurally Generated Soundscapes

Another compelling application is to procedurally generate soundscapes by animating the filter parameters over time or in response to in-game parameters. Here’s an example:

# Assume this code is part of a larger function that updates the environment sounds
func _update_environment_sounds(weather_intensity):
    notch_filter.bandwidth_hz = weather_intensity * 50 # Adjust based on weather
    notch_filter.gain = 0.1 * weather_intensity # Slightly change the gain

This script tweaks the notch filter to create audio effects that react dynamically to the in-game weather intensity.

Creating Audio Moods

Imagine you want to create a spooky atmosphere when the player enters a particular area. With the notch filter, you can achieve this by automating frequency changes:

func _on_enter_spooky_area():
    notch_filter.cutoff_hz = 700 # Sets a dark-sounding frequency 
    notch_filter.bandwidth_hz = 50 # Narrow bandwidth for a focused effect
    # Possibly fade into this state for a smoother transition

This code would execute when a player enters a designated spooky area, instantly altering the soundscape to match the mood.

Simulating Acoustic Environments

By combining the notch filter with other effects like reverb, you can simulate different acoustic environments. Here’s how you might simulate the acoustics of a cave:

# Add a reverb effect to the same bus for added depth
var reverb =
AudioServer.add_bus_effect(0, reverb)

# Configure both the notch filter and reverb to simulate a cave's acoustics
notch_filter.cutoff_hz = 400
notch_filter.bandwidth_hz = 100
reverb.room_size = 8.0
reverb.damping = 0.7

This combination of effects mimics the echoes and frequency characteristics of a large, damp space.

Isolating In-Game Audio Signals

Suppose your game features a “Listen” mode, where players must isolate specific in-game audio signals (like the sound of an approaching enemy). You can manipulate the notch filter to help isolate these sounds:

func _on_activate_listen_mode():
    notch_filter.cutoff_hz = enemy_sound_frequency
    notch_filter.bandwidth_hz = 20 # Very narrow to isolate the sound
    # Other game audio settings might be adjusted here to focus on the enemy sound

This function switches the game audio into a mode emphasizing the frequency where an enemy’s footsteps are most prominent, helping the player detect them more easily.

As you can see, the AudioEffectNotchFilter opens up a world of possibilities for game developers looking to enrich their sound design. By mastering the use of this tool, you can create more immersive, interactive, and emotionally affecting gaming experiences. We encourage you to try out these techniques and continue exploring the audible dimension of your games. With Godot and the notch filter, the only limit is your imagination.

Let’s push our exploration of the AudioEffectNotchFilter further. Here are a few more examples demonstrating the potential of this tool for innovative audio effects in Godot. These examples will illustrate how to fine-tune and integrate the notch filter into your in-game sound design.

Imagine a mechanic where a player uses a device to tune into different radio frequencies to receive important messages:

func _on_change_radio_frequency(value):
    notch_filter.cutoff_hz = value
    # The bandwidth is kept tight to simulate the tuning of a radio
    notch_filter.bandwidth_hz = 5

This code simulates tuning a radio by adjusting the cutoff frequency of the notch filter based on an input value, such as dragging a slider or turning a knob in-game.

Next, let’s consider adjusting the notch filter to counteract the effects of a player’s in-game injury with audio cues:

func _on_player_injured():
    # When the player is injured, a high-pitched ring might be heard
    notch_filter.cutoff_hz = 12000
    notch_filter.bandwidth_hz = 50
    # Reducing gain can simulate temporary hearing loss
    notch_filter.gain = -24

This scenario uses the notch filter to simulate tinnitus and temporary hearing loss, which could occur after an explosion or a fall, creating a more immersive experience.

Let’s add variance to environmental noises, such as wind through trees, which should not sound uniform:

func _adjust_wind_noise():
    var rng =
    # Randomly adjust the cutoff frequency to vary the sound of the wind
    notch_filter.cutoff_hz = rng.rand_range(200, 800)

By randomly altering the cutoff frequency within a certain range, this function creates a natural and varying wind sound that prevents audio from sounding repetitive and static.

The notch filter can also be used in combination with other audio nodes to create a sense of space. For example, let’s simulate the muffled sound heard from underwater:

func _simulate_underwater_effect():
    notch_filter.cutoff_hz = 400
    notch_filter.bandwidth_hz = 1000
    # The gain is reduced to create a 'dulled' sonic experience
    notch_filter.gain = -15
    # Add an AudioEffectReverb for depth
    var reverb =
    reverb.room_size = 0.8
    reverb.damping = 0.2
    AudioServer.add_bus_effect(0, reverb)

Here, the notch filter is configured with a wide bandwidth and reduced gain to simulate the damping effect of water on sound. The added reverb enriches the underwater acoustic effect.

For games with a stealth mechanic, you might want to focus the player’s attention on enemy movements. Here’s how to dynamically adjust the notch filter in response to an enemy’s proximity:

func _on_enemy_approaching(distance):
    var proximity_factor = max_distance - distance
    notch_filter.cutoff_hz = 1000 + proximity_factor * 100
    notch_filter.bandwidth_hz = 200 - proximity_factor * 10
    # Boost gain slightly to emphasize the approaching enemy's footsteps
    notch_filter.gain = 3

This script increases the gain and adjusts the frequency and bandwidth of the notch filter depending on the distance to the enemy, simulating heightened awareness as they get closer.

Finally, we can manipulate the filter’s settings in real-time to rhythmically enhance musical elements in your game:

func _process(delta):
    # Assume 'beat_time' is the duration of a musical beat
    var t = (OS.get_ticks_msec() % beat_time) / beat_time
    var cutoff = lerp(500, 3000, abs(sin(t * PI)))
    notch_filter.cutoff_hz = cutoff

This code snippet uses a sinusoidal function to rhythmically sweep the cutoff frequency of the notch filter in time with the game’s music, adding a pulsating effect to the audio.

These examples demonstrate only a fraction of what can be achieved with the AudioEffectNotchFilter in Godot 4. As you dive into your game development journey, consider the countless possibilities that sound design offers. With creative application of the notch filter and other audio effects, you will enhance the emotional and sensory depth of your game worlds. It’s an area where investing time to experiment and refine can truly pay off and set your game apart. Have fun experimenting with these sounds and best of luck in your development endeavors!

Continue Your Game Development Journey

Your exploration into the world of audio effects with Godot doesn’t have to end here! Audio design is a vast and nuanced field, and there’s always more to learn and experiment with to make your games stand out.

If you found this tutorial useful and are keen to dive deeper into the realm of game development with Godot, we encourage you to check out our Godot Game Development Mini-Degree. This all-encompassing course collection provides a thorough grounding in not only audio but all aspects of game development using the powerful Godot engine. Regardless of whether you are starting out or looking to sharpen your existing skills, this Mini-Degree can help you on your journey to becoming a seasoned game developer.

And if you’re looking for an even broader range of Godot-related content, our full range of Godot courses awaits you. These courses cover a variety of topics and provide you with the flexible learning options and high-quality content that Zenva prides itself on.

Remember, the best way to learn is by doing, and with Zenva, you’ll be creating, coding, and bringing your ideas to life in no time. So go ahead, take the next step, and continue to build your skills and your dreams with Godot and Zenva.


In the soundscape of game development, mastering audio effects like the Godot’s AudioEffectNotchFilter is akin to an artist mastering their palette of colors. The subtleties of sound design are what can elevate your game from good to unforgettable, creating an immersive experience that resonates with your players long after they’ve put the controller down. We’ve embarked on a sonic journey today, but this is merely the beginning. Continue experimenting with Godot, and remember – the only limit is your imagination.

Whether you’re just starting out, or you’re looking to add another layer of polish to your game development process, our Godot Game Development Mini-Degree is the perfect companion on your quest to bring captivating audio and engaging gameplay to life. With Zenva, you’re not just learning – you’re creating pathways to bring your dreams into reality. Take that step, and let’s craft incredible game experiences, one sound at a time.

Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.