GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizgame/soundtrack

the sounds, the music and the air of a game, made for it by a model. A game says the mood of its world (Game.soundtrack); this module owns what follows from that: the engine's own sounds a game can have (a walker's step, a jump, the start and the end of play), the words each file is made from, and its path in the game's lock. giz assets soundtrack makes the files that the lock lacks, and the Game plays them by their names.

gizlang
import * as Soundtrack from "gizgame/soundtrack";

Types

Take

gizlang
type Take = { prompt?: string; seconds?: f64; seed?: i64; model?: string; gain?: f64; takes?: i64; }

One made sound as a developer tunes it. Each field left out is the engine's: the words it is made from (PROMPT), its SECONDS, its SEED (another seed is another try of the same words), the MODEL that makes it (the maker's when none), how loud it is beside the others (GAIN, 1 as the engine levels it), and how many TAKES the game goes through in turn, so a footstep does not repeat.

  • prompt: _gizlang_sdk_core.Option<string>
  • seconds: _gizlang_sdk_core.Option<f64>
  • seed: _gizlang_sdk_core.Option<i64>
  • model: _gizlang_sdk_core.Option<string>
  • gain: _gizlang_sdk_core.Option<f64>
  • takes: _gizlang_sdk_core.Option<i64>

Soundtrack

gizlang
type Soundtrack = { mood: string; feel?: string; sounds?: Map<string, Take>; music?: Map<string, Take>; air?: Take; without?: Vec<string>; }

A game's sound, made for it. MOOD says its world in a few words: the music and the air are made from it, and the sounds from FEEL (what is heard close by: the ground, the shoes, the room), or from MOOD without one. With only these the engine has its own sounds, one music and, in a 3D game, the air. SOUNDS, MUSIC and AIR tune one by its name or add one: a sound that play(NAME) plays, a music that tune(NAME) turns to (play is the game's own, title the title screen's). WITHOUT names what the game goes without ("air", "music", a sound).

  • mood: string
  • feel: _gizlang_sdk_core.Option<string>
  • sounds: _gizlang_sdk_core.Option<_gizlang_sdk_collections.Map<string, M201.Take>>
  • music: _gizlang_sdk_core.Option<_gizlang_sdk_collections.Map<string, M201.Take>>
  • air: _gizlang_sdk_core.Option<M201.Take>
  • without: _gizlang_sdk_core.Option<Vec<string>>

Wanted

gizlang
type Wanted = { name: string; kind: string; path: string; prompt: string; seconds: f64; seed: i64; model: string; gain: f64; }

One file to make: NAME as the game and the tool call it, the KIND of maker (gizlang/catalog: sound, music, ambience), its PATH in the lock, the PROMPT, its SECONDS, SEED, MODEL ("" the maker's) and GAIN.

  • name: string
  • kind: string
  • path: string
  • prompt: string
  • seconds: f64
  • seed: i64
  • model: string
  • gain: f64

Functions

musicOf

gizlang
function musicOf(name: string): string

The channel's name of a music NAME, as the Game's loops and the tool's NAME have it.

Effects: fail, alloc.

wanted

gizlang
function wanted(track: Soundtrack, uses: Vec<string>, airy: bool): Vec<Wanted>

The files TRACK asks for. USES names the engine's own sounds the game can play (a walker's, the flow's); AIRY says that the game has a world with air (a 3D game). A sound of several takes is a file a take, NAME.N.

Effects: fail, read, write, console, io, alloc.