All Projects → MoritzBrueckner → aura

MoritzBrueckner / aura

Licence: other
A fast and lightweight 3D audio engine for Kha.

Programming Languages

haxe
709 projects
c
50402 projects - #5 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aura

sonic-track
Uses a raspberry pi camera or web cam and python opencv to track motion in camera view. Sends motion contour data to sonic-pi via osc interface to produce and control notes/sample. Includes ability to use onscreen menu areas to change synthesizer, octaves Etc.
Stars: ✭ 24 (-22.58%)
Mutual labels:  sound
reverb
Straightforward (sound/multipurpose) reverberator
Stars: ✭ 23 (-25.81%)
Mutual labels:  sound
birds
Bird Sound Synthesis based on AM+FM
Stars: ✭ 46 (+48.39%)
Mutual labels:  sound
libDaisy
Hardware Library for the Daisy Audio Platform
Stars: ✭ 164 (+429.03%)
Mutual labels:  sound
X-Piano
Now you can make your own piano!
Stars: ✭ 13 (-58.06%)
Mutual labels:  sound
mt762x-wm8960
MT762X WM8960 ALSA SoC machine driver
Stars: ✭ 19 (-38.71%)
Mutual labels:  sound
soundtransform
Android & Pure Java library for sound manipulation
Stars: ✭ 42 (+35.48%)
Mutual labels:  sound
Mezzanine
A game engine that supports high performance 3d graphics physics and sound
Stars: ✭ 18 (-41.94%)
Mutual labels:  sound
figaro
Real-time voice-changer for voice-chat, etc. Will support many different voice-filters and features in the future. 🎵
Stars: ✭ 362 (+1067.74%)
Mutual labels:  sound
lisp-gui-examples
GUI for generating a tone in various Lisp dialects
Stars: ✭ 28 (-9.68%)
Mutual labels:  sound
alsa-utils
The Advanced Linux Sound Architecture (ALSA) - utilities
Stars: ✭ 122 (+293.55%)
Mutual labels:  sound
hUGEDriver
An easy-to-use, fast, tracker-based, public domain sound driver for Game Boy homebrew
Stars: ✭ 26 (-16.13%)
Mutual labels:  sound
glicol
(Audio) graph-oriented live coding language and music DSP library written in Rust
Stars: ✭ 853 (+2651.61%)
Mutual labels:  sound
sound-garden
A personal journey into the audio synth domain
Stars: ✭ 21 (-32.26%)
Mutual labels:  sound
soube
Music player based on electronjs
Stars: ✭ 32 (+3.23%)
Mutual labels:  sound
ears
Easy Api in Rust to play Sounds
Stars: ✭ 81 (+161.29%)
Mutual labels:  sound
audio-playback
Ruby/Command Line Audio File Player
Stars: ✭ 20 (-35.48%)
Mutual labels:  sound
Eisenkraut
A multi-channel and hi-res capable audio file editor.
Stars: ✭ 50 (+61.29%)
Mutual labels:  sound
roover
🐱 A lightweight audio library for React apps.
Stars: ✭ 70 (+125.81%)
Mutual labels:  sound
zero-noise
A lightweight multicolor noise generator for sound masking
Stars: ✭ 23 (-25.81%)
Mutual labels:  sound

aura_banner.png

Aura is a fast and lightweight 3D audio engine for Kha to ease creating realistic sound atmospheres for your games and applications.

Table of Content

Features

  • Multiple attenuation models for 3D sound
  • Mix channels for modifying groups of sounds together
  • Doppler effect
  • Noise generator channels
  • Built-in DSP filters:
    • High-/band-/lowpass filter
    • Haas effect
  • Extendable DSP system – easily write your own filters
  • [Experimental] Support for HRTFs (head-related transfer functions)

Setup

In your project directory, create a folder called Subprojects. Then, open a command line in that folder and execute the following command (Git must be installed on your machine):

git clone https://github.com/MoritzBrueckner/aura.git

Then, add the following line to your project's khafile.js (if you're using Armory 3D, you can skip this step):

await project.addProject("Subprojects/aura");

If you're using Iron, but not Armory 3D, please also add the following to your Khafile to be able to use Iron's vector classes with Aura:

project.addDefine("AURA_WITH_IRON");

Usage

  • Load sounds (and automatically uncompress them when needed):

    import aura.Aura;
    
    ...
    
    Aura.init(); // <-- Don't forget this!
    
    var loadConfig: AuraLoadConfig = {
        uncompressed: [  // <-- List of sounds to uncompress
            "MySoundFile",
        ],
        compressed: [  // <-- List of sounds to remain compressed
            "AnotherSoundFile",
        ],
        hrtf: [  // <-- List of .mhr HRTF files for the HRTFPanner, if used
            "myHRTF_mhr",
        ],
        // Empty lists can be omitted!
    };
    
    Aura.loadSounds(loadConfig, () -> {
        // You can access the loaded sounds with `Aura.getSound()`
        var mySound: kha.Sound = Aura.getSound("MySoundFile");
    });

    Alternative to referencing sounds by hard-coded names (like it's done in the above example), you can also rely on Kha's asset system and use the IDE's autocompletion for assistance:

    kha.Assets.sounds.MySoundFileName; // Note the "Name" ending. This will give you the ID name for this sound
    kha.Assets.blobs.myHRTF_mhrName; // The same works for blobs (and for other asset types as well)

    As a positive side effect you will get errors during compile time if an asset does not exist.

  • Play a sound:

    // Plays the sound `mySound` without repeat on the master channel
    Aura.createHandle(Play, mySound).play();
    
    // Plays the sound `mySound` with repeat on the master channel
    Aura.createHandle(Play, mySound, true).play();
    
    // Plays the sound `mySound` without repeat on the predefined fx channel
    Aura.createHandle(Play, mySound, false, Aura.mixChannels["fx"]).play();
    
    // You can also stream sounds directly from disk. Whether a sound can be
    // streamed highly depends on the target and whether the sound is compressed
    // or not. Please consult the Kha sources if in doubt.
    Aura.createHandle(Stream, mySound, false, Aura.mixChannels["music"]).play();

    Aura.createHandle() returns a Handle object with which you can control the playback and relevant parameters.

  • Create a MixChannel to control a group of sounds:

    // Create a channel for all voices for example.
    // The channel can also be accessed with `Aura.mixChannels["voice"]`
    var voiceChannel = Aura.createMixChannel("voice");
    
    // Mix the output of `voiceChannel` into the master channel
    Aura.masterChannel.addInputChannel(voiceChannel);
    
    Aura.createHandle(Play, mySound, false, voiceChannel).play();
  • Add a lowpass filter to the master channel:

    import aura.dsp.Filter;
    
    ...
    
    Aura.createHandle(Play, mySound).play();
    
    var lowPass = new Filter(LowPass);
    lowPass.setCutoffFreq(1000); // Frequency in Hertz
    
    // Aura.masterChannel is short for Aura.mixChannels["master"]
    Aura.masterChannel.addInsert(lowPass);
    
  • 2D sound:

    var mySoundHandle = Aura.createHandle(Play, mySound);
    
    // Some utility constants
    mySoundHandle.setBalance(LEFT);
    mySoundHandle.setBalance(CENTER); // Default
    mySoundHandle.setBalance(RIGHT);
    
    // Set angle in degrees between -90 (left) and 90 (right)
    // You can also use Rad(value) for radians in [-pi/2, pi/2]
    mySoundHandle.setBalance(Deg(30));
  • 3D sound:

    import aura.dsp.panner.HRTFPanner;
    import aura.dsp.panner.StereoPanner;
    
    ...
    
    var cam = getCurrentCamera(); // <-- dummy function
    var mySoundHandle = Aura.createHandle(Play, mySound);
    
    // Create a panner for the sound handle (choose one)
    new StereoPanner(channel); // Simple left-right panner
    new HRTFPanner(channel, Aura.getHRTF("myHRTF_mhr"));  // More realistic panning using head-related transfer functions, but slower to calculate
    
    // Set the 3D location and view direction of the listener
    Aura.listener.set(cam.worldPosition, cam.look, cam.right);
    
    // Set the 3D location of the sound independent of the math API used
    mySoundHandle.panner.setLocation(new kha.math.FastVector3(-1.0, 1.0, 0.2));
    mySoundHandle.panner.setLocation(new iron.math.Vec3(-1.0, 1.0, 0.2));
    mySoundHandle.panner.setLocation(new aura.math.Vec3(-1.0, 1.0, 0.2));
    
    // Apply the changes to the sound to make them audible (!)
    mySoundHandle.panner.update3D();
    
    // Switch back to 2D sound. The sound's saved location will not be reset, but
    // you won't hear it at that location anymore. The panner however still exists
    // and can be re-enabled via update3D().
    mySoundHandle.panner.reset3D();

    Aura's own Vec3 type can be implicitly converted from and to Kha or Iron vectors (3D and 4D)!

Platform Support

Thanks to Haxe and Kha, Aura runs almost everywhere!

The following targets were tested so far:

Target Tested environments Supported Notes
Armorcore (Krom) Windows
HTML5 - No dedicated audio thread for non-streaming playback
- If kha.SystemImpl.mobileAudioPlaying is true, streamed playback is not included in the Aura mix pipeline (no DSP etc.)
Hashlink/C Windows
hxcpp Windows

License

This work is licensed under multiple licences, which are specified at .reuse/dep5 (complying to the REUSE recommendations). The license texts can be found in the LICENSES directory, or in case of submodules in their respective repositories.

Short summary:

  • The entire source code in Sources/aura is licensed under the Zlib license which is a very permissive license also used by Kha and Armory at the time of writing this. This is the important license for you if you include Aura code in your project.
  • This readme file and other configuration files are licensed under CC0-1.0.
  • All files in .img/ are licensed under CC-BY-4.0.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].