Documentation
¶
Overview ¶
Package music generates short, perfectly-looping chiptune tracks from a small deterministic parameter set, rendered entirely through the gion synthesis core: every note is a gion.Params scheduled on a step grid and mixed into one buffer. The same Params always produce the same samples, so a game can ship a seed instead of an audio file.
The design follows the classic NES conventions: a square lead built from a short motif arranged in an AABA form over a chord progression, a triangle bass on chord roots, and noise percussion on euclidean patterns. Mood picks scale, progression, tempo and timbre together.
Index ¶
Constants ¶
const ( MuteLead = 1 << iota MuteEcho MuteBass MuteKick MuteSnare MuteHat )
Mute bits: set a bit in Params.Mute to silence that instrument — for isolating a voice in the workbench, or shipping a reduced arrangement. The bit order matches the internal voice order.
Variables ¶
var Moods = map[string]Mood{ "upbeat": Upbeat, "heroic": Heroic, "dark": Dark, "chill": Chill, "battle": Battle, "boss": Boss, }
Moods maps the mood names to their values, for CLIs and UIs.
Functions ¶
This section is empty.
Types ¶
type Mood ¶
type Mood int
Mood selects the musical character: scale, chord progression, default tempo, lead timbre and swing.
type Params ¶
type Params struct {
Seed int64
Mood Mood
Tempo float64 // BPM; 0 = the mood's tempo
Bars int // loop length; 0 = 16 (an AABA of 4-bar phrases)
Root float64 // tonic frequency in Hz; 0 = 220 (A3)
Gain float64 // output level (0..1); 0 = 0.6
Mute int // bitmask of silenced instruments (MuteLead, MuteBass, ...)
// Mixer levels per instrument group, multiplying the built-in balance.
// 0 means 1.0 (unchanged); the workbench exposes them as sliders so the
// mix can be set by ear and saved with the track.
LeadVol float64
BassVol float64
DrumVol float64
}
Params describes one track. Zero fields fall back to the mood's defaults (or the package defaults for Bars, Root and Gain); use New for a ready set.