GithubHelp home page GithubHelp logo

geegaz / audioeventsystem Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 61 KB

A flexible SFX plugin for Godot 4.x

License: MIT License

GDScript 100.00%
godot godot-addon godot-engine godot4 godot-plugin

audioeventsystem's Introduction

Audio Event System

A flexible SFX plugin for Godot 4.x

Introduction

The goal of this plugin is to give the most common features needed for sound effects (like randomized stream and randomized pitch) while also removing the need for multiple AudioStreamPlayers to play different sounds. This plugin changes the audio workflow to bring it a bit closer to audio middlewares like FMOD, using AudioEvent resources to setup sound effects and an AudioEventManager to play them.

Plugin structure

a beautiful graph to explain the structure of the plugin, that may or may not have been made in ms-paint

The plugin relies on a single resource, the AudioEvent. This resource contains the information needed to play a single sound effect:

  • a list of AudioStream
  • a minimum and maximum pitch
  • a minimum and maximum volume

This resource is then used either directly through code by calling one of the AudioEventManager's method, or by using an AudioEventEmitter which is a node dedicated to play an AudioEvent and designed as a replacement for an AudioStreamPlayer in the scene hierarchy.

Example of playing an AudioEvent directly with the AudioEventManager:

@export var event : AudioEvent

func play_event_directly() -> void:
    # Play the event without spatialization
    AudioEventManager.play_event(event)

Example of playing an AudioEvent through an AudioEventEmitter:

@onready var _Emitter := $AudioEventEmitter

func play_event_emitter() -> void:
    _Emitter.play()

Like AudioStreamPlayers, AudioEventEmitters come in 3 types:

  • AudioEventEmitter, a non-spatialized emitter for global events
  • AudioEventEmitter2D, an emitter spatialized in 2D
  • AudioEventEmitter3D, an emitter spatialized in 3D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.