{"_id":"8bit-sound-engine","_rev":"5-658c0b6c031f80a125137b45d076cbd8","name":"8bit-sound-engine","dist-tags":{"latest":"1.0.0"},"versions":{"0.2.0":{"name":"8bit-sound-engine","version":"0.2.0","keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"author":{"name":"hiranotomo"},"license":"MIT","_id":"8bit-sound-engine@0.2.0","maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"homepage":"https://8bit-eight.vercel.app","bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"dist":{"shasum":"6b541c6b5f7b9a2b25d3347436829afca2429fb9","tarball":"https://registry.npmjs.org/8bit-sound-engine/-/8bit-sound-engine-0.2.0.tgz","fileCount":17,"integrity":"sha512-5F8fbspaO6e4YY1ijKf/hqEN8ary4gyiPuf7S1bEQSbndspyITMz01drKK5d70suqQ1QwCz61hWp0iV9687WXA==","signatures":[{"sig":"MEUCIFUupZzHRfwzy0cpIHBAxz/kc5K/ITDHq0AxZQcc32DrAiEA2tq8a+Vh/Mfuk5DQaWKDfIXh7XNLX+46/ZR+iqpzDVI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40697},"main":"dist/8bit-sound-engine.cjs","type":"module","types":"dist/index.d.ts","module":"dist/8bit-sound-engine.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/8bit-sound-engine.js","require":"./dist/8bit-sound-engine.cjs"}},"gitHead":"4c53bc394020c9dff1e73cbe811f5589547b45e7","scripts":{"dev":"vite","test":"vitest run","build":"vite build && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist","build:all":"npm run build && npm run build:cdn","build:cdn":"vite build --mode cdn","build:demo":"vite build --mode demo","prepublishOnly":"npm run build"},"_npmUser":{"name":"hiranotomoyasu","email":"tomo@teleport.jp"},"repository":{"url":"git+https://github.com/hiranotomo/8bit-sound-engine.git","type":"git"},"_npmVersion":"11.8.0","description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","directories":{},"_nodeVersion":"25.5.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^8.0.3","vitest":"^4.1.2","typescript":"^6.0.2"},"_npmOperationalInternal":{"tmp":"tmp/8bit-sound-engine_0.2.0_1775047610999_0.8198672086974297","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"8bit-sound-engine","version":"0.5.0","keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"author":{"name":"hiranotomo"},"license":"MIT","_id":"8bit-sound-engine@0.5.0","maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"homepage":"https://8bit-eight.vercel.app","bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"dist":{"shasum":"07486576f825e686657765fdcd1bcf46b8022a29","tarball":"https://registry.npmjs.org/8bit-sound-engine/-/8bit-sound-engine-0.5.0.tgz","fileCount":18,"integrity":"sha512-xkPi5Wuqt2O+6xQ1s0u77ZsRuXHKoPtPLvTzQVehs0J/NjP+jJ18bOnOaVx/VCir+O1fVCqcE0Bt5E49f11OqA==","signatures":[{"sig":"MEUCIQCIcWgUYzuDUpVJYuAuE9w+cMxvhIU1Q1mSEQv5T9wwqgIgDolT8iHToDwoL1ImlcknFfADaOMWMDDF4394XqWnVm0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45901},"main":"dist/8bit-sound-engine.cjs","type":"module","types":"dist/index.d.ts","module":"dist/8bit-sound-engine.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/8bit-sound-engine.js","require":"./dist/8bit-sound-engine.cjs"}},"gitHead":"5671be2a9a0a3e35d1679a0195062d4666798269","scripts":{"dev":"vite","test":"vitest run","build":"vite build && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist","build:all":"npm run build && npm run build:cdn","build:cdn":"vite build --mode cdn","build:demo":"vite build --mode demo","prepublishOnly":"npm run build"},"_npmUser":{"name":"hiranotomoyasu","email":"tomo@teleport.jp"},"repository":{"url":"git+https://github.com/hiranotomo/8bit-sound-engine.git","type":"git"},"_npmVersion":"11.8.0","description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@upstash/redis":"^1.37.0","@anthropic-ai/sdk":"^0.81.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^8.0.3","vitest":"^4.1.2","typescript":"^6.0.2","@vercel/node":"^5.6.23"},"_npmOperationalInternal":{"tmp":"tmp/8bit-sound-engine_0.5.0_1775063255872_0.9801680188506889","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"8bit-sound-engine","version":"0.6.0","keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"author":{"name":"hiranotomo"},"license":"MIT","_id":"8bit-sound-engine@0.6.0","maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"homepage":"https://8bit-eight.vercel.app","bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"dist":{"shasum":"76e5df183b8c9f1e4923ae4711cc6bc6c54076ef","tarball":"https://registry.npmjs.org/8bit-sound-engine/-/8bit-sound-engine-0.6.0.tgz","fileCount":24,"integrity":"sha512-QraTZJV+RQnLemWnvVdkqAy6L1s0GDkK/g4vX15WEWfMAxm030RFwbLNacJuvN4/UJXOXPZzQDylyQFNw9l1+A==","signatures":[{"sig":"MEUCIAFUWpi5XVBrsSqtyvEYu+n8Rmq/Gaf0bk/lprF/fnTqAiEAspXHKvlcBjmcajYhaUyDoP4MJXZWORw0bDPUT0tFrLg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":135987},"main":"dist/8bit-sound-engine.cjs","type":"module","types":"dist/index.d.ts","module":"dist/8bit-sound-engine.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/8bit-sound-engine.js","require":"./dist/8bit-sound-engine.cjs"}},"gitHead":"10eec65fd8464d0d23b4c95a092547c4972de503","scripts":{"dev":"vite","test":"vitest run","build":"vite build && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist","build:all":"npm run build && npm run build:cdn","build:cdn":"vite build --mode cdn","build:demo":"vite build --mode demo","prepublishOnly":"npm run build"},"_npmUser":{"name":"hiranotomoyasu","email":"tomo@teleport.jp"},"repository":{"url":"git+https://github.com/hiranotomo/8bit-sound-engine.git","type":"git"},"_npmVersion":"11.8.0","description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@upstash/redis":"^1.37.0","@anthropic-ai/sdk":"^0.81.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^8.0.3","vitest":"^4.1.2","typescript":"^6.0.2","@vercel/node":"^5.6.23"},"_npmOperationalInternal":{"tmp":"tmp/8bit-sound-engine_0.6.0_1775095964011_0.14625709151763866","host":"s3://npm-registry-packages-npm-production"}},"0.6.1":{"name":"8bit-sound-engine","version":"0.6.1","keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"author":{"name":"hiranotomo"},"license":"MIT","_id":"8bit-sound-engine@0.6.1","maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"homepage":"https://8bit-eight.vercel.app","bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"dist":{"shasum":"60ca09143f86df935a77dcfc15b433d1bb511a3c","tarball":"https://registry.npmjs.org/8bit-sound-engine/-/8bit-sound-engine-0.6.1.tgz","fileCount":24,"integrity":"sha512-7bTjt9vvgWt3DzWZP6b8hy+b+C4kEeEAwiUbHKbxnwZ4gTnWM+E7sQQLZKYrc4wLX3Iv3WxIf3XYlRQfcncZ1w==","signatures":[{"sig":"MEQCIHi49pwGUC7GqQ2HYKEts8Ztsuw6xob1CucsPd2x4Y3jAiAupJi6+IIgomS8Oh0IA17jjUmncjH4bPVTTfb6+VKqCw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136240},"main":"dist/8bit-sound-engine.cjs","type":"module","types":"dist/index.d.ts","module":"dist/8bit-sound-engine.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/8bit-sound-engine.js","require":"./dist/8bit-sound-engine.cjs"}},"gitHead":"1a6fca89411d593199c34e1a80109953cc5fe607","scripts":{"dev":"vite","test":"vitest run","build":"vite build && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist","build:all":"npm run build && npm run build:cdn","build:cdn":"vite build --mode cdn","build:demo":"vite build --mode demo","prepublishOnly":"npm run build"},"_npmUser":{"name":"hiranotomoyasu","email":"tomo@teleport.jp"},"repository":{"url":"git+https://github.com/hiranotomo/8bit-sound-engine.git","type":"git"},"_npmVersion":"11.8.0","description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@upstash/redis":"^1.37.0","@anthropic-ai/sdk":"^0.81.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^8.0.3","vitest":"^4.1.2","typescript":"^6.0.2","@vercel/node":"^5.6.23"},"_npmOperationalInternal":{"tmp":"tmp/8bit-sound-engine_0.6.1_1775097037630_0.09538238158743106","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"8bit-sound-engine","version":"1.0.0","description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","type":"module","main":"dist/8bit-sound-engine.cjs","module":"dist/8bit-sound-engine.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/8bit-sound-engine.js","require":"./dist/8bit-sound-engine.cjs","types":"./dist/index.d.ts"}},"scripts":{"dev":"vite","build":"vite build && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist","build:cdn":"vite build --mode cdn","build:demo":"vite build --mode demo","build:all":"npm run build && npm run build:cdn","test":"vitest run","prepublishOnly":"npm run build"},"keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"author":{"name":"hiranotomo"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/hiranotomo/8bit-sound-engine.git"},"homepage":"https://8bit-eight.vercel.app","devDependencies":{"@vercel/node":"^5.6.23","typescript":"^6.0.2","vite":"^8.0.3","vitest":"^4.1.2"},"dependencies":{"@anthropic-ai/sdk":"^0.81.0","@upstash/redis":"^1.37.0"},"gitHead":"b2fa25df483e79373603ac06921ec48c835d3ea3","_id":"8bit-sound-engine@1.0.0","bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"_nodeVersion":"25.5.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-w49wnbHZ3hfChpe954XwlVp27SVKr91oHbxXD+id4d2f+oHc/lkhqXx2RAnh9y6b9eTv/A1X/YDyMcCLoX9MpQ==","shasum":"d952a3b51ad3882de610a7f8155f3c8e0178aa6b","tarball":"https://registry.npmjs.org/8bit-sound-engine/-/8bit-sound-engine-1.0.0.tgz","fileCount":24,"unpackedSize":136248,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAG/R24ZX4KurQdfV0wLtZFIEy8RMugsCoUFHwITasW7AiAeA4l6H4uGjUzdn/SH6DWvHlsjgj+VrwDUdOE8AvJcPQ=="}]},"_npmUser":{"name":"hiranotomoyasu","email":"tomo@teleport.jp"},"directories":{},"maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/8bit-sound-engine_1.0.0_1775097756398_0.5001722517602594"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-01T12:46:50.999Z","modified":"2026-04-02T02:42:36.691Z","0.2.0":"2026-04-01T12:46:51.152Z","0.5.0":"2026-04-01T17:07:36.039Z","0.6.0":"2026-04-02T02:12:44.168Z","0.6.1":"2026-04-02T02:30:37.761Z","1.0.0":"2026-04-02T02:42:36.551Z"},"bugs":{"url":"https://github.com/hiranotomo/8bit-sound-engine/issues"},"author":{"name":"hiranotomo"},"license":"MIT","homepage":"https://8bit-eight.vercel.app","keywords":["8bit","chiptune","web-audio","game-audio","sound-engine","retro","pixel"],"repository":{"type":"git","url":"git+https://github.com/hiranotomo/8bit-sound-engine.git"},"description":"Chiptune sound engine for web apps — BGM, SE, reverb, variations. Built for AI coding assistants.","maintainers":[{"name":"hiranotomoyasu","email":"tomo@teleport.jp"}],"readme":"# 8bit Sound Engine\n\nA lightweight, dependency-free 8-bit game music engine built on the Web Audio API. Generate chiptune BGM and sound effects entirely from code — no audio files needed.\n\n**[Live Studio](https://8bit-eight.vercel.app)** | **[AGENTS.md](./AGENTS.md)** (AI integration guide)\n\n## Features\n\n- **Programmatic synthesis** — Square, triangle, sawtooth, and noise channels (NES/Famicom style)\n- **BGM playback** — Define tracks as JSON, loop with fade transitions between scenes\n- **Variations** — Named arrangement presets to mute/unmute channel layers\n- **10 built-in sound effects** — Jump, coin, damage, powerup, gameover, select, cancel, explosion, laser, 1up\n- **Custom sound effects** — Define your own SE with the same JSON format\n- **Reverb** — Optional convolution reverb with configurable mix\n- **Zero dependencies** — Pure Web Audio API, under 3KB gzipped\n- **TypeScript** — Full type definitions included\n- **AI-ready** — AGENTS.md teaches Claude Code how to add sound to any web app\n\n## Install\n\n### npm\n\n```bash\nnpm install 8bit-sound-engine\n```\n\n```ts\nimport { createSoundEngine } from '8bit-sound-engine'\nconst engine = createSoundEngine()\n```\n\n### CDN\n\n```html\n<script src=\"https://8bit-eight.vercel.app/sdk.js\"></script>\n<script>\n  const engine = EightBit.createSoundEngine()\n</script>\n```\n\n## Quick Start\n\n```ts\nimport { createSoundEngine } from '8bit-sound-engine'\n\nconst engine = createSoundEngine({\n  reverb: { duration: 1.8, decay: 2.5, mix: 0.2 }\n})\n\n// Play a preset sound effect\nengine.se.play('coin')\nengine.se.play('jump')\n\n// Define and play BGM\nengine.bgm.play({\n  bpm: 140,\n  loop: true,\n  variations: [\n    { name: 'FULL', layers: [true, true] },\n    { name: 'SOLO', layers: [true, false] },\n  ],\n  channels: [\n    {\n      wave: 'square',\n      label: 'melody',\n      volume: 0.3,\n      notes: [\n        { pitch: 'C4', duration: '8n' },\n        { pitch: 'E4', duration: '8n' },\n        { pitch: 'G4', duration: '4n' },\n      ]\n    },\n    {\n      wave: 'triangle',\n      label: 'bass',\n      volume: 0.35,\n      notes: [\n        { pitch: 'C2', duration: '2n' },\n        { pitch: 'G2', duration: '2n' },\n      ]\n    }\n  ]\n})\n\n// Apply a variation\nengine.bgm.setVariation('SOLO')\n\n// Switch BGM with crossfade\nengine.bgm.changeTo(otherTrack, { fade: 500 })\n\n// Stop BGM\nengine.bgm.stop({ fade: 300 })\n```\n\n## API\n\n### `createSoundEngine(options?)`\n\nCreates and returns a `SoundEngine` instance.\n\nOptions:\n- `reverb` — `boolean | { duration?: number; decay?: number; mix?: number }`\n\n### `engine.bgm`\n\n| Method | Description |\n|--------|-------------|\n| `play(definition)` | Start playing a BGM track |\n| `changeTo(definition, { fade? })` | Crossfade to a different track |\n| `stop({ fade? })` | Stop playback with optional fade-out |\n| `setVariation(name)` | Apply a named variation preset |\n| `setChannelMute(index, muted)` | Mute/unmute a channel by index |\n| `toggleChannel(index)` | Toggle channel mute state |\n| `setChannelPan(index, pan)` | Set channel pan (-1 left, 1 right) |\n\n### `engine.se`\n\n| Method | Description |\n|--------|-------------|\n| `play(name)` | Play a preset sound effect by name |\n| `play(name, { pitch?, pan? })` | Play with pitch/pan adjustment |\n| `play(definition)` | Play a custom sound effect |\n\n### `engine.resume()`\n\nResume the AudioContext (required after user interaction in browsers).\n\n### `engine.setReverbMix(mix)`\n\nAdjust reverb wet/dry mix (0.0 - 1.0).\n\n## BGM Definition Format\n\n```ts\ninterface BGMDefinition {\n  bpm: number\n  loop?: boolean\n  channels: ChannelDefinition[]\n  variations?: Variation[]\n}\n\ninterface ChannelDefinition {\n  wave: 'square' | 'triangle' | 'sawtooth' | 'noise'\n  label?: string           // e.g. 'melody', 'bass', 'harmony'\n  duty?: number            // Square wave duty cycle (default: 0.5)\n  volume?: number          // 0.0 - 1.0 (default: 0.5)\n  pan?: number             // -1 (left) to 1 (right), default 0\n  notes: NoteEvent[]\n}\n\ninterface Variation {\n  name: string\n  layers: boolean[]        // which channels are active (maps 1:1 to channels)\n}\n\ninterface NoteEvent {\n  pitch: string | null     // e.g. 'C4', 'F#5', 'Bb3', or null for rest\n  duration: string         // '1n', '2n', '4n', '8n', '16n', '32n'\n}\n```\n\n## Preset Sound Effects\n\n`jump` `coin` `damage` `powerup` `gameover` `select` `cancel` `explosion` `laser` `1up`\n\n## Channel Architecture\n\nInspired by the NES/Famicom audio hardware:\n\n| Channel | Waveform | Typical Use |\n|---------|----------|-------------|\n| Pulse 1 | Square (variable duty) | Melody |\n| Pulse 2 | Square (variable duty) | Harmony |\n| Triangle | Triangle | Bass |\n| Noise | White noise | Percussion / SFX |\n\n## Development\n\n```bash\nnpm install\nnpm run dev           # Start dev server with demo page\nnpm test              # Run tests\nnpm run build         # Build library (ESM + CJS)\nnpm run build:cdn     # Build CDN bundle (public/sdk.js)\nnpm run build:demo    # Build demo page\nnpm run build:all     # Build library + CDN\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}