Next: , Previous: , Up: API Reference   [Contents][Index]


2.4 Audio

A game isn’t complete without sound. Most games play some cool background music to set the mood and have many sound effects to play when events happen. The (chickadee audio) module provides a robust audio API backed by the OpenAL 3D audio system.

The basics of playing audio are very simple. Just load an audio file in the load hook (or anywhere else once the game loop is running) and play it!

(use-modules (chickadee audio))

(define audio #f)

(define (load)
  (set! audio (load-audio "neat-sound-effect.wav"))
  (audio-play audio))

(run-game #:load load)

For more advanced usage, check out the full API reference in the following sections.