Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
opusgamelabs avatar

Game Audio

  • 717 installs
  • 305 repo stars
  • Updated May 25, 2026
  • opusgamelabs/game-creator

Game Audio is a game-creator agent skill that generates low-intensity looping Strudel BGM patterns with cycle alternation and phasing so background music stays subtle during gameplay prototypes.

About

Game Audio is an opusgamelabs/game-creator skill for genre-specific background music using Strudel live-coding patterns. Each pattern layers instruments with stack(), starts loops via .play(), and applies .slow(2-4), .room(), and .delay() so music breathes instead of overpowering gameplay. The skill enforces background-appropriate mixing—rests with ~, sine and triangle waves over square, and gain ranges like 0.10-0.18 for lead melodies and 0.08-0.15 for pads. Developers reach for Game Audio when prototyping indie or jam games that need ambient loops without hiring a composer or loading heavy audio middleware. Outputs are copy-paste Strudel pattern strings tuned for cycle alternation and phasing, ready to drop into web-based game prototypes.

  • BGM mix rules: low gains (lead ~0.10–0.18), liberal rests, sine/triangle bias, `.slow(2-4)`, reverb/delay instead of den
  • Anti-repetition via `<[phrase1] [phrase2] …>` cycle alternation on every pattern
  • Layer phasing with different `.slow()` per stack to desync loops
  • Genre-specific background music templates using `stack()` and `.play()`
  • Explicit guidance to avoid loud drums except when needed (gain under 0.3)

Game Audio by the numbers

  • 717 all-time installs (skills.sh)
  • +29 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #33 of 247 Game Development skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/opusgamelabs/game-creator --skill game-audio

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs717
repo stars305
Security audit2 / 3 scanners passed
Last updatedMay 25, 2026
Repositoryopusgamelabs/game-creator

How do you write subtle looping game BGM?

Generate looping, low-intensity Strudel BGM patterns for game prototypes with cycle alternation and phasing so music stays background-appropriate.

Who is it for?

Game developers prototyping web or Strudel-based games who need quiet, loopable background tracks without a DAW pipeline.

Skip if: AAA projects requiring FMOD/Wwise middleware, licensed stems, or non-looping cinematic scores.

When should I use this skill?

A developer asks for game background music, Strudel BGM patterns, or low-intensity looping audio for a prototype.

What you get

Strudel BGM pattern code with layered instruments, gain levels, and phasing-ready loop structures.

  • Strudel BGM pattern strings
  • Layered loop configurations

By the numbers

  • Recommends lead melody gain between 0.10 and 0.18
  • Recommends pad gain between 0.08 and 0.15
  • Uses .slow(2-4) to stretch Strudel pattern cycles

Files

SKILL.mdMarkdownGitHub ↗

Game Audio Engineer (Web Audio API)

You are an expert game audio engineer. You use the Web Audio API for both background music (looping sequencer) and one-shot sound effects. Zero dependencies — everything is built into the browser.

Performance Notes

  • Take your time with each step. Quality is more important than speed.
  • Do not skip validation steps — they catch issues early.
  • Read the full context of each file before making changes.
  • Test every sound in the browser. Web Audio timing is different from what you expect.

Reference Files

For detailed reference, see companion files in this directory:

  • sequencer-pattern.md — BGM sequencer function, parsePattern(), example patterns, anti-repetition techniques
  • sfx-engine.mdplayTone(), playNotes(), playNoise(), all SFX presets
  • mute-button.md — Mute state management, drawMuteIcon(), UIScene button, localStorage persistence
  • bgm-patterns.md — Strudel BGM pattern examples
  • strudel-reference.md — Strudel.cc API reference
  • mixing-guide.md — Volume levels table and style guidelines per genre

Tech Stack

PurposeEnginePackage
Background musicWeb Audio API sequencerBuilt into browsers
Sound effectsWeb Audio API one-shotBuilt into browsers
SynthsOscillatorNode (square, triangle, sawtooth, sine)
EffectsGainNode, BiquadFilterNode, ConvolverNode, DelayNode

No external audio files or npm packages needed — all sounds are procedural.

File Structure

src/
├── audio/
│   ├── AudioManager.js    # AudioContext init, BGM sequencer, play/stop
│   ├── AudioBridge.js     # Wires EventBus → audio playback
│   ├── music.js           # BGM patterns (sequencer note arrays)
│   └── sfx.js             # SFX (one-shot oscillator + gain + filter)

AudioManager (BGM Sequencer + AudioContext)

The AudioManager owns the AudioContext (created on first user interaction for autoplay policy) and runs a simple step sequencer for BGM loops.

// AudioManager.js — Web Audio API BGM sequencer + SFX context

class AudioManager {
  constructor() {
    this.ctx = null;
    this.currentBgm = null; // { stop() }
    this.masterGain = null;
  }

  init() {
    if (this.ctx) return;
    this.ctx = new (window.AudioContext || window.webkitAudioContext)();
    this.masterGain = this.ctx.createGain();
    this.masterGain.connect(this.ctx.destination);
  }

  getCtx() {
    if (!this.ctx) this.init();
    return this.ctx;
  }

  getMaster() {
    if (!this.masterGain) this.init();
    return this.masterGain;
  }

  playMusic(patternFn) {
    this.stopMusic();
    try {
      this.currentBgm = patternFn(this.getCtx(), this.getMaster());
    } catch (e) {
      console.warn('[Audio] BGM error:', e);
    }
  }

  stopMusic() {
    if (this.currentBgm) {
      try { this.currentBgm.stop(); } catch (_) {}
      this.currentBgm = null;
    }
  }

  setMuted(muted) {
    if (this.masterGain) {
      this.masterGain.gain.value = muted ? 0 : 1;
    }
  }
}

export const audioManager = new AudioManager();

BGM Sequencer Pattern

See sequencer-pattern.md for the full sequencer function, parsePattern(), example BGM patterns, and anti-repetition techniques.

SFX Engine (Web Audio API -- one-shot)

See sfx-engine.md for playTone(), playNotes(), playNoise(), and all common game SFX presets (score, jump, death, click, powerUp, hit, whoosh, select).

AudioBridge (wiring EventBus -> audio)

import { eventBus, Events } from '../core/EventBus.js';
import { audioManager } from './AudioManager.js';
import { gameplayBGM, gameOverTheme } from './music.js';
import { scoreSfx, deathSfx, clickSfx } from './sfx.js';

export function initAudioBridge() {
  // Init AudioContext on first user interaction (browser autoplay policy)
  eventBus.on(Events.AUDIO_INIT, () => audioManager.init());

  // BGM transitions
  eventBus.on(Events.MUSIC_GAMEPLAY, () => audioManager.playMusic(gameplayBGM));
  eventBus.on(Events.MUSIC_GAMEOVER, () => audioManager.playMusic(gameOverTheme));
  eventBus.on(Events.MUSIC_STOP, () => audioManager.stopMusic());

  // SFX (one-shot)
  eventBus.on(Events.SCORE_CHANGED, () => scoreSfx());
  eventBus.on(Events.PLAYER_DIED, () => deathSfx());
}

Mute State Management

See mute-button.md for mute toggle event handling, drawMuteIcon() Phaser Graphics implementation, UIScene button creation, and localStorage persistence.

Integration Checklist

1. Create src/audio/AudioManager.js — AudioContext + sequencer + master gain 2. Create src/audio/music.js — BGM patterns as note arrays + sequencer calls 3. Create src/audio/sfx.js — SFX using Web Audio API (oscillator + gain + filter) 4. Create src/audio/AudioBridge.js — wire EventBus events to audio 5. Wire initAudioBridge() in main.js 6. Emit AUDIO_INIT on first user click (browser autoplay policy) 7. Emit MUSIC_GAMEPLAY, MUSIC_GAMEOVER, MUSIC_STOP at scene transitions 8. Add mute toggleAUDIO_TOGGLE_MUTE event, UI button, M key shortcut 9. Test: BGM loops seamlessly, SFX fire once and stop, mute silences everything

Important Notes

  • Zero dependencies: Everything uses the built-in Web Audio API. No npm packages needed for audio.
  • Browser autoplay: AudioContext MUST be created/resumed from a user click/tap. The AUDIO_INIT event handles this.
  • Master gain for mute: Route everything through a single GainNode. Setting gain.value = 0 mutes all audio instantly.
  • Sequencer timing: The look-ahead scheduler (schedules 100ms ahead, checks every 25ms) gives sample-accurate timing with no drift. This is the standard Web Audio scheduling pattern.
  • No external audio files needed: Everything is synthesized with oscillators.
  • SFX are instant: Web Audio API fires immediately with zero scheduler latency.

Optional: Strudel.cc Upgrade

For richer procedural BGM with pattern language support, you can optionally install @strudel/web:

npm install @strudel/web

Note: Strudel is AGPL-3.0 — projects using it must be open source. See strudel-reference.md and bgm-patterns.md in this directory for Strudel-specific patterns.

The Strudel upgrade replaces the Web Audio sequencer for BGM only. SFX always use Web Audio API directly.

Related skills

How it compares

Use Game Audio for quick Strudel loops in prototypes; use a DAW pipeline when shipping polished multi-stem soundtracks.

FAQ

What gain levels does Game Audio recommend?

Game Audio recommends lead melody gain between 0.10 and 0.18 and pad layers between 0.08 and 0.15. Keeping gains low prevents BGM from masking gameplay audio and UI feedback.

Which Strudel functions does Game Audio use?

Game Audio patterns use stack() to layer instruments, .play() to start loops, and effects like .slow(2-4), .room(), and .delay(). Rests (~) and calmer waveforms keep loops background-appropriate.

Is Game Audio safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.