Skip to content

mateolarreaferro/SatieLang

Repository files navigation

SatieLang

SatieLang is a Domain Specific Language (DSL) for generative and event-based audio scripting in Unity. Define complex audio behaviors with simple, declarative syntax.

Setup

Unity Version

You need Unity 6000.1.1f1. Download from:

API Keys Configuration

SatieLang uses API keys for AI-powered features. Setup is simple:

  1. Copy Assets/APIKeys.cs.example to Assets/APIKeys.cs
  2. Add your API keys:
public static class APIKeys
{
    public const string ANTHROPIC = "sk-ant-api03-...";   // Required for AI code generation
    public const string OPENAI = "sk-proj-...";           // Required for speech input
    public const string ELEVENLABS = "sk_...";            // Required for audio generation
    public const string GOOGLE = "";                      // Optional
}

Get your keys from:

The APIKeys.cs file is gitignored so your keys stay private.

Alternative: Set environment variables with the SATIE_API_KEY_ prefix:

export SATIE_API_KEY_ANTHROPIC="sk-ant-..."
export SATIE_API_KEY_OPENAI="sk-proj-..."
export SATIE_API_KEY_ELEVENLABS="sk_..."

Environment variables take priority over the file.

Quick Start

  1. Open the project in Unity
  2. Navigate to Assets > Tutorial folder
  3. Open the "Hello World" scene
  4. Press Play

Creating Your First Script

  1. Right-click in the Project window
  2. Select Create > Satie Script (.sat)
  3. Rename and edit your script
  4. Create an empty GameObject in your scene
  5. Add the SatieRuntime component
  6. Assign your .sat script to the Script File field

Basic Syntax

Playback Types

# One-shot sound (plays once)
oneshot "explosion"
    volume 0.9

# Looping sound (plays continuously)
loop "ambient"
    volume 0.5

Randomization

Use to to create ranges:

loop "footsteps" every 0.5to1.5
    volume 0.6to0.9        # Random volume
    pitch 0.9to1.1         # Random pitch

Interpolation

Animate parameters over time:

loop "engine"
    volume goto(0and0.8 as inquad in 2)           # Fade in
    pitch gobetween(0.5and2.0 as linear in 3)     # Oscillate

Easing functions: linear, inquad, outquad, inoutquad, incubic, outcubic, inoutcubic

Multiple Instances

5 * loop "bird_chirp"
    volume 0.3to0.6
    pitch 0.8to1.3

Timing and Fading

loop "ambient"
    start 2.0                          # Delay start
    volume goto(0and0.8 in 2)          # Fade in over 2 seconds
    end 10 fade 2                      # End at 10s with 2s fade out

Groups

Apply properties to multiple sounds:

group background
    volume 0.5

    loop "layer1"
        volume goto(0and0.5 in 1)

    loop "layer2"
        volume goto(0and0.5 in 2)
endgroup

3D Audio

loop "flying_sound"
    move fly speed 1                    # Random 3D movement
    visual trail                        # Visual effect

oneshot "static_sound"
    move x 10 y 5 z -10                 # Fixed position

Comments

# This is a comment
loop "music"  # Inline comment
    volume 0.5

Quick Reference

Feature Example
Loop loop "ambient"
One-shot oneshot "click"
Repeat oneshot "beep" every 2to5
Volume volume 0.8 or volume 0.5to1.0
Pitch pitch 0.9to1.1
Start delay start 2.0
End with fade end 10 fade 2
Fade in volume goto(0and0.8 in 2)
Interpolate goto(0and1 as inquad in 2)
Oscillate gobetween(0.5and2 as linear in 3)
Multiple 3 * loop "rain"
Group group intro

Additional Resources

For a complete tutorial, see SatieLang Tutorial.

About

Human-In-The-Loop Tool for Generative Spatial Audio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages