/sonic-asteroids

Sound engine for devstopfix/elixoids (for Coding Night #7)

Primary LanguageSwiftMIT LicenseMIT

SonicAsteroids sound engine

A sound engine for macOS, written in Swift 4.2, for the Elixoids v3 game engine. Listen to the cacophony with headphones.

Getting started

To install dependencies you will need XCode and Carthage (this can be installed using homebrew.)

SonicAsteroids has been tested on:

  • Xcode 11.5 on 10.15.5 (Catalina)
  • Xcode 10.1 on 10.13.6 (High Sierra)
  • Xcode 7.3.1 on OS X 10.11 (El Capitan)

Build

brew install carthage

carthage update

Scripting

When starting the application from the command line, the first argument can be used to pass the URL of the game:

~/Applications/SonicAsteroids.app/Contents/MacOS/SonicAsteroids ws://game.example.com/0/sound

Sound Client Protocol

Sound events can be received at ws://example.com/0/sound as described in the sound protocol document. For maximum network efficiency we recommend sending an Accept: application/octet-stream header and consuming protobufs.

The pan is a float from -1 to +1 where -1 is hard left and zero is center. See the pan property. We apply a function y=x³ to the linear pan sent by the game to keep most sounds centered but push out sounds at the very edge of the screen.