The Sound of Hidden Structure
RuneGrid’s soundtrack is not built from long prerecorded tracks.
Instead, the game constructs music from small reusable motifs: short note sequences that can be transformed, varied, softened, mirrored, rotated, and recombined.
This mirrors the design philosophy of the game itself.
Players are not expected to consciously think about finite groups or algebraic structure while solving puzzles. But underneath the surface, the game is built from transformations and relationships. The music follows the same principle.
Motifs as musical seeds
Each family of levels in RuneGrid has a characteristic base motif.
For example:
static let cycleMotif = Motif(notes: [
SynthNote(frequency: 261.63, duration: 1.2, amplitude: 0.048),
SynthNote(frequency: 293.66, duration: 0.7, amplitude: 0.04),
SynthNote(frequency: 329.63, duration: 0.95, amplitude: 0.046),
SynthNote(frequency: 392.00, duration: 0.75, amplitude: 0.043),
...
])
These motifs are intentionally small and restrained. They are closer to fragments or patterns than complete melodies.
The goal is not to create a dominant soundtrack, but a calm evolving atmosphere that subtly reinforces the puzzle structures beneath the game.
Matching musical identity to puzzle families
Different level families select different base motifs:
static func baseMotif(for familyName: String) -> Motif {
switch familyName {
case "Cycles", "Long Cycles", "Deep Cycles", "Endless Cycles":
return cycleMotif
case "Mirror Turns", "Triangle Turns":
return mirrorMotif
case "Order Matters", "Linked Cycles":
return orderMotif
case "Twin Reflections", "Parity Cube":
return parityMotif
case "Quaternion Pairs":
return quaternionMotif
default:
return baseMotif
}
}
The interesting thing is that the player is never explicitly told this correspondence exists.
But over time, certain musical colours begin to attach themselves to certain structural ideas:
- cyclic puzzles feel more flowing
- mirror puzzles feel more reflective
- quaternion-inspired puzzles feel more unstable and rotating
The soundtrack becomes another layer of pattern language.
Musical transformations
Rather than composing hundreds of separate tracks, RuneGrid transforms motifs algorithmically.
One of the simplest transformations is rotation:
static func rotated(_ motif: Motif, by steps: Int) -> Motif {
guard !motif.notes.isEmpty else { return motif }
let count = motif.notes.count
let shift = ((steps % count) + count) % count
let rotated = Array(motif.notes[shift...] + motif.notes[..<shift])
return Motif(notes: rotated)
}
This preserves the musical material while changing its starting point.
Conceptually, this mirrors cyclic structure in the game itself: the same relationships appear again, but from a shifted perspective.
Other transformations include:
- reversal
- inversion
- transposition
- rhythmic stretching
- inserted rests
- echo endings
Each one creates variation without losing identity.
Pentatonic snapping
One problem with procedural music is that arbitrary transformations can quickly become unpleasant.
RuneGrid avoids this by snapping notes onto a pentatonic scale:
static let pentatonicMIDINotes: [Int] = [
48, 50, 52, 55, 57,
60, 62, 64, 67, 69,
72, 74, 76, 79, 81
]
Any transformed note is mapped to the nearest pentatonic pitch:
let nearest = pentatonicMIDINotes.min(by: {
abs(Double($0) - midi) < abs(Double($1) - midi)
}) ?? 60
This acts as a kind of musical constraint system.
Even after transformations, the soundtrack tends to remain calm and consonant.
Companion motifs
RuneGrid also generates softer companion layers from existing motifs:
static func companion(
from motif: Motif,
semitones: Int,
stretch: Double,
amplitudeScale: Double = 0.65
) -> Motif
These companion voices are:
- transposed
- stretched rhythmically
- softened in amplitude
- interrupted with rests
The result is less like a melody with accompaniment, and more like overlapping mathematical echoes.
Hiding the machinery
One of the central tensions in RuneGrid is deciding what should remain visible to the player.
The game deliberately avoids overwhelming players with:
- group theory terminology
- algebraic notation
- explicit structural explanations
The music follows the same philosophy.
The player does not need to know:
- why motifs rotate
- why inversions occur
- why some puzzle families sound different
They only need to feel that the game possesses an internal coherence.
Ideally, the soundtrack feels like hidden structure made audible.
And that is probably the closest thing RuneGrid has to a musical philosophy.