How Audio works in Godot internally

SIsilicon28SIsilicon28 Posts: 35Member

I am asking out of curiosity. I already know about the 2D and 3D graphics renderers. glsl, binding buffers, textures, UBO's. The likes. However I don't really much how audio is handled. Do you use openAL? Why are their multiple audio drivers? How do the buses' effects change the sound? On CPU or somewhere else?

Tagged:

Tags :

Answers

  • CalinouCalinou Posts: 193Admin Godot Developer
    edited May 8 Answer ✓

    I didn't write Godot's audio engine, but I'll try to answer anyway:

    Do you use openAL?

    No, Godot uses its own audio driver implementations which are fairly mature now, so it wouldn't make much sense to replace them with OpenAL or similar.

    Why are their multiple audio drivers?

    Each audio driver is tailored for a specific platform. You can find their source code in the drivers/ directory of the Godot repository.

    To clarify:

    • Godot on Windows uses RtAudio,
    • Godot on macOS uses CoreAudio,
    • Godot on Linux uses PulseAudio by default but can be configured to use ALSA instead.

    How do the buses' effects change the sound? On CPU or somewhere else?

    It's all done on the CPU – hardware sound acceleration hasn't been a thing on modern OSes for a long time now (since Windows Vista at least). You can read mode about audio buses in the documentation.

  • SIsilicon28SIsilicon28 Posts: 35Member

    I never new you could make a custom audio driver. I always thought it was limited to the hardware like graphics drivers.

  • GarromOrcShamanGarromOrcShaman Posts: 174Member

    @SIsilicon28 said:
    I never new you could make a custom audio driver. I always thought it was limited to the hardware like graphics drivers.

    Well, Graphics card (as well as its driver) is incredibly complicated thing. Inside graphic card is CPU, RAM, advanced cooling system and many other features. Graphic card is basically tiny computer inside computer.This is not much of surprise if you realize what everything graphics card must complete to render spinning cube. There is big amount of incredibly difficult jobs what must be done including lighting, shadows, normal maps, reflections, textures, models and many others.And now to audio. Audio card is very simple and carry almost no hardware features. Mostly it serves just like a bridge allowing you to connect more complex audio system (starting with mono sound as simplest to surround audio as very complex). Most of work is done by software, the audio card just distribute beats to the reproductors connected to it (understand "beat" as short pulse of electricity used to move membrane of reproductor)

    To finish this. Is possible to create own audio driver but not graphic driver because audio is much, much simpler.

Sign In or Register to comment.