sfx

package
v0.0.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sfx holds Linefire's pure sound-synthesis helpers over gion, shared by the game runtime and the editors so a previewed sound is exactly the played one. Everything here is deterministic and device-free: functions return PCM (16-bit little-endian stereo at gion.DefaultRate); playing it is the caller's business.

Index

Constants

View Source
const LoopSeconds = 1.0

LoopSeconds is the length of one rendered loop. Long enough that the repetition is not read as rhythm, short enough to render instantly.

View Source
const VariationCount = 4

VariationCount is how many siblings of a base sound the game cycles through, so repeated shots or explosions do not sound identical.

Variables

This section is empty.

Functions

func Bases

func Bases() []string

Bases lists every renderable base sound name (weapon recipes + gion presets + loop recipes), sorted — the editor's pick list.

func IsMusicFile

func IsMusicFile(name string) bool

IsMusicFile reports whether a theme names an audio file rather than a gion mood.

func Known

func Known(base string) bool

Known reports whether base names a renderable sound — a one-shot (weapon recipe or gion preset) or a continuous loop recipe. Editors use it to flag a typo.

func KnownMood

func KnownMood(name string) bool

KnownMood reports whether name is a gion music mood (cheap; Track without the render). Editors use it to flag a typo before playing silence.

func LoopSamples

func LoopSamples(base string, seed int64) []int16

LoopSamples renders one seamless loop of a continuous base, or nil when the base is not a known loop recipe.

func Moods

func Moods() []string

Moods lists the gion music mood names, sorted — the editor's pick list for theme sounds.

func Render

func Render(base string, seed int64) []byte

Render synthesizes one base sound — a one-shot (weapon recipe or gion preset), or a single pass of a continuous loop — to stereo PCM. It is the editor's preview: what this returns is what the game plays. Unknown base -> nil.

func Stereo16

func Stereo16(samples []int16) []byte

Stereo16 packs mono samples into the 16-bit little-endian stereo stream the audio context expects, duplicating each sample into both channels.

func Track

func Track(mood string, seed int64) []byte

Track synthesizes one looping track for a gion mood name, or nil for a name the music engine does not know. The lead is muted: its high notes turn repetitive fast in a game loop (playtest + a known gion finding); bass and drums carry the mood.

func Variations

func Variations(base string, seed int64) [][]byte

Variations resolves a one-shot base (weapon recipe or gion preset) and renders the base plus its variations to stereo PCM. Unknown base -> nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL