{"_id":"@8bitforge/chiptune-synth","_rev":"4-ef8a37854ad13ec6aadc781e4feab081","name":"@8bitforge/chiptune-synth","dist-tags":{"latest":"3.1.0"},"versions":{"2.0.0":{"name":"@8bitforge/chiptune-synth","version":"2.0.0","keywords":["chiptune","synthesizer","8bit","8-bit","retro","web-audio","webaudio","synth","sound","music","gamedev","game-audio","sfx","sound-effects","preset","audio","oscillator","nes","gameboy","midi","instruments","filter","lfo","unison"],"author":{"name":"8Binami","email":"contact@8binami.com"},"license":"SEE LICENSE IN LICENSE","_id":"@8bitforge/chiptune-synth@2.0.0","maintainers":[{"name":"8binami","email":"hello@8binami.com"}],"homepage":"https://8bitforge.com","bugs":{"url":"https://github.com/8Binami/chiptune-synth/issues"},"dist":{"shasum":"72f3ce01a503a0a63a71acdb64162c6e728d53c6","tarball":"https://registry.npmjs.org/@8bitforge/chiptune-synth/-/chiptune-synth-2.0.0.tgz","fileCount":4,"integrity":"sha512-e6XGtZEAr4LH0sBy+OglDwhEd02CtlQLUpCgiuVWf/BRLd2cUZM2kqdCS+NznjIahR7EakYDIeNqhTYNpjTkPw==","signatures":[{"sig":"MEUCIQCl0uRmHd+BnE5CXoc+A2W62sygrXNDBrGG3Z3zxOu/GgIgJaDD6yeNPiR+jarO7MOmkCzQt897c8mmLIW+FOlHNKI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68479},"main":"src/chiptune-synth.js","unpkg":"src/chiptune-synth.js","module":"src/chiptune-synth.js","browser":"src/chiptune-synth.js","gitHead":"7c308ee02e6ee042bc49e294ccfdfcc51ed5bded","scripts":{"start":"open index.html"},"_npmUser":{"name":"8binami","email":"hello@8binami.com"},"repository":{"url":"git+https://github.com/8Binami/chiptune-synth.git","type":"git"},"_npmVersion":"11.11.0","description":"8-bit chiptune synthesizer — zero dependencies, 4 tracks, 12 instruments, 10 SFX presets, MIDI support, unison, filters, LFOs. Retro game audio in 3 lines of code.","directories":{},"_nodeVersion":"25.8.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/chiptune-synth_2.0.0_1773586645467_0.665194497120974","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@8bitforge/chiptune-synth","version":"2.0.1","keywords":["chiptune","synthesizer","8bit","8-bit","retro","web-audio","webaudio","synth","sound","music","gamedev","game-audio","sfx","sound-effects","preset","audio","oscillator","nes","gameboy","midi","instruments","filter","lfo","unison"],"author":{"name":"8Binami","email":"contact@8binami.com"},"license":"SEE LICENSE IN LICENSE","_id":"@8bitforge/chiptune-synth@2.0.1","maintainers":[{"name":"8binami","email":"hello@8binami.com"}],"homepage":"https://chiptune-synth.8binami.com","bugs":{"url":"https://github.com/8Binami/chiptune-synth/issues"},"dist":{"shasum":"8d1f6bc96ab0f52c6c9405cc84b9a8060a25cb16","tarball":"https://registry.npmjs.org/@8bitforge/chiptune-synth/-/chiptune-synth-2.0.1.tgz","fileCount":4,"integrity":"sha512-6LynBY4O9V42JukvxpHQbKm59cuB14tUjF2kQVfySXBo9ZadukT2eERKU7LYnEDjoGtDPjYpahT/UxdaQdo3Xg==","signatures":[{"sig":"MEQCID3EppV3CSd0r+vfgIrXGCKLDEHt+9oHjLuXF18ukE+zAiBIX/65P0GT44E8PaXPvBGTJPw4KSgome14RbN8NQO53w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68815},"main":"src/chiptune-synth.js","unpkg":"src/chiptune-synth.js","module":"src/chiptune-synth.js","browser":"src/chiptune-synth.js","gitHead":"b27e8788691369704df878c0a85bec1bc67b8b50","scripts":{"start":"open index.html"},"_npmUser":{"name":"8binami","email":"hello@8binami.com"},"repository":{"url":"git+https://github.com/8Binami/chiptune-synth.git","type":"git"},"_npmVersion":"11.11.0","description":"8-bit chiptune synthesizer — zero dependencies, 4 tracks, 12 instruments, 10 SFX presets, MIDI support, unison, filters, LFOs. Retro game audio in 3 lines of code.","directories":{},"_nodeVersion":"25.8.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/chiptune-synth_2.0.1_1773650592734_0.20269270918678983","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@8bitforge/chiptune-synth","version":"3.0.0","keywords":["chiptune","synthesizer","8bit","8-bit","retro","web-audio","webaudio","synth","sound","music","gamedev","game-audio","sfx","sound-effects","preset","audio","oscillator","nes","gameboy","midi","instruments","filter","lfo","unison","mixer","effects","reverb","delay","distortion","arpeggiator","bitcrusher","compressor"],"author":{"name":"8Binami","email":"contact@8binami.com"},"license":"SEE LICENSE IN LICENSE","_id":"@8bitforge/chiptune-synth@3.0.0","maintainers":[{"name":"8binami","email":"hello@8binami.com"}],"homepage":"https://chiptune-synth.8binami.com","bugs":{"url":"https://github.com/8Binami/chiptune-synth/issues"},"dist":{"shasum":"bf07dccc318aba57e0c2b107dcc8d960f975194a","tarball":"https://registry.npmjs.org/@8bitforge/chiptune-synth/-/chiptune-synth-3.0.0.tgz","fileCount":7,"integrity":"sha512-I6adCblC6Ao/wWsPSm8isl4ZEqd4jpOguJszt4AeoIsEZmrLxDEo4OWgai7Tj6HSMnhNxjEOHKo2HmkrGbCbsA==","signatures":[{"sig":"MEUCIQCf5bKGcI8McNazO5rx35KGd5aVwcBrPO8zAsS6aKl4/wIgHJT0kRX9A8kTbMYI+4TiLVBqYkV9VBbrNZqDMXKxuQc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1016854},"main":"dist/3.0.0/chiptune-synth.min.js","unpkg":"dist/3.0.0/chiptune-synth.min.js","module":"dist/3.0.0/chiptune-synth.min.js","browser":"dist/3.0.0/chiptune-synth.min.js","gitHead":"2fa19dcd713c802adb390610e3d79dcbc88a2d9e","scripts":{"build":"node build.js && node build-soundfont.js","start":"open index.html","build:engine":"node build.js","prepublishOnly":"node build.js","build:soundfont":"node build-soundfont.js"},"_npmUser":{"name":"8binami","email":"hello@8binami.com"},"repository":{"url":"git+https://github.com/8Binami/chiptune-synth.git","type":"git"},"_npmVersion":"11.11.0","description":"Ultimate 8-bit chiptune synthesizer — 8 tracks, 170+ instruments, effects chain (distortion/chorus/delay/reverb/bitcrusher), mixer console, arpeggiator, master limiter, MIDI. Zero dependencies.","directories":{},"_nodeVersion":"25.8.0","_hasShrinkwrap":false,"devDependencies":{"terser":"^5.46.1","javascript-obfuscator":"^5.4.1"},"_npmOperationalInternal":{"tmp":"tmp/chiptune-synth_3.0.0_1775507486513_0.3080248383637054","host":"s3://npm-registry-packages-npm-production"}},"3.1.0":{"name":"@8bitforge/chiptune-synth","version":"3.1.0","description":"Ultimate 8-bit chiptune synthesizer — 8 tracks, 170+ instruments, effects chain (distortion/chorus/delay/reverb/bitcrusher), mixer console, arpeggiator, master limiter, MIDI. Zero dependencies.","main":"dist/3.1.0/chiptune-synth.min.js","module":"dist/3.1.0/chiptune-synth.min.js","browser":"dist/3.1.0/chiptune-synth.min.js","unpkg":"dist/3.1.0/chiptune-synth.min.js","keywords":["chiptune","synthesizer","8bit","8-bit","retro","web-audio","webaudio","synth","sound","music","gamedev","game-audio","sfx","sound-effects","preset","audio","oscillator","nes","gameboy","midi","instruments","filter","lfo","unison","mixer","effects","reverb","delay","distortion","arpeggiator","bitcrusher","compressor"],"author":{"name":"8Binami","email":"contact@8binami.com"},"license":"SEE LICENSE IN LICENSE","repository":{"type":"git","url":"git+https://github.com/8Binami/chiptune-synth.git"},"homepage":"https://chiptune-synth.8binami.com","bugs":{"url":"https://github.com/8Binami/chiptune-synth/issues"},"_id":"@8bitforge/chiptune-synth@3.1.0","_nodeVersion":"25.8.0","_npmVersion":"11.11.0","dist":{"integrity":"sha512-E5x7exlMG7RulLQbIR+ekAI7+Bt0gwH3LkIH4/c5Xj0fArFhhcfhqR6WFhDprmcVZ5JwQxGUvOBNyFvnwdildg==","shasum":"9e7ad86709efafd2be5b7fe385fa315283c1a2fb","tarball":"https://registry.npmjs.org/@8bitforge/chiptune-synth/-/chiptune-synth-3.1.0.tgz","fileCount":9,"unpackedSize":1251105,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCrCEix6YuvjKPBN4ay1tgpteTKFtEH3C8C7mFaUW5R1AIgXsCf2cDSP5e+TqymO26vNRUTHm4j1Qab3y5BUAQIJG0="}]},"_npmUser":{"name":"8binami","email":"hello@8binami.com"},"directories":{},"maintainers":[{"name":"8binami","email":"hello@8binami.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chiptune-synth_3.1.0_1778717441954_0.3593118774037558"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-15T14:57:25.394Z","modified":"2026-05-14T00:10:42.304Z","2.0.0":"2026-03-15T14:57:25.613Z","2.0.1":"2026-03-16T08:43:12.887Z","3.0.0":"2026-04-06T20:31:26.743Z","3.1.0":"2026-05-14T00:10:42.156Z"},"bugs":{"url":"https://github.com/8Binami/chiptune-synth/issues"},"author":{"name":"8Binami","email":"contact@8binami.com"},"license":"SEE LICENSE IN LICENSE","homepage":"https://chiptune-synth.8binami.com","keywords":["chiptune","synthesizer","8bit","8-bit","retro","web-audio","webaudio","synth","sound","music","gamedev","game-audio","sfx","sound-effects","preset","audio","oscillator","nes","gameboy","midi","instruments","filter","lfo","unison","mixer","effects","reverb","delay","distortion","arpeggiator","bitcrusher","compressor"],"repository":{"type":"git","url":"git+https://github.com/8Binami/chiptune-synth.git"},"description":"Ultimate 8-bit chiptune synthesizer — 8 tracks, 170+ instruments, effects chain (distortion/chorus/delay/reverb/bitcrusher), mixer console, arpeggiator, master limiter, MIDI. Zero dependencies.","maintainers":[{"name":"8binami","email":"hello@8binami.com"}],"readme":"# ChiptuneSynth\r\n\r\n**The ultimate 8-bit audio engine for the browser.**\r\n\r\n[![npm](https://img.shields.io/npm/v/@8bitforge/chiptune-synth?color=00f0ff&style=flat-square)](https://www.npmjs.com/package/@8bitforge/chiptune-synth)\r\n[![version](https://img.shields.io/badge/version-3.1.0-00f0ff?style=flat-square)](#)\r\n[![license](https://img.shields.io/badge/license-source--sealed-a855f7?style=flat-square)](#license)\r\n[![size](https://img.shields.io/badge/size-~43KB_min-green?style=flat-square)](#)\r\n[![deps](https://img.shields.io/badge/dependencies-0-brightgreen?style=flat-square)](#)\r\n\r\n8 tracks. 170+ instruments. Full effects chain. Mixer. Arpeggiator. Master limiter. MIDI. Zero dependencies. Pure Web Audio API.\r\n\r\n```js\r\nconst synth = new ChiptuneSynth();\r\nawait synth.init();\r\nsynth.playPreset('coin');  // ding!\r\n```\r\n\r\n---\r\n\r\n## Features\r\n\r\n### Synthesis Engine\r\n- **8 Tracks** — Lead, Harmony, Bass, Arp, Kick, Snare, Hi-hat, FX\r\n- **5 Waveforms** — Square (PWM), Triangle, Sawtooth, Sine, Noise\r\n- **ADSR Envelopes** — Per-track attack, decay, sustain, release\r\n- **Unison Voices** — 1–16 voices per track with detune & stereo spread\r\n- **3 LFOs per Track** — Vibrato (pitch), tremolo (amplitude), filter modulation\r\n- **Per-track Filters** — Lowpass / Highpass / Bandpass with cutoff, resonance, key tracking, filter envelope\r\n- **Pitch Envelope & Glide** — Per-voice pitch sweep and portamento\r\n- **Pitch Bend & Mod Wheel** — Real-time performance controls\r\n\r\n### Effects Chain (per track)\r\nSignal path: `input → distortion → chorus → delay → reverb → bitcrusher → output`\r\n\r\n- **Distortion** — WaveShaper with 4x oversampling, variable drive\r\n- **Chorus** — Modulated delay with LFO rate and depth\r\n- **Delay** — Feedback delay up to 2 seconds with wet/dry mix\r\n- **Reverb** — Convolution reverb with variable decay\r\n- **Bitcrusher** — Bit depth (1–16 bits) and sample rate reduction\r\n\r\n### Mixer Console (per track)\r\n- **Fader** — Independent channel volume\r\n- **Pan** — StereoPanner with full left/right range\r\n- **3-band EQ** — Low shelf (320 Hz), Peaking mid (1 kHz), High shelf (3.2 kHz)\r\n- **Compressor** — Threshold, ratio, attack, release per track\r\n- **Solo / Mute** — Non-destructive per-track control\r\n- **VU Metering** — RMS level per track and master\r\n\r\n### Master Bus\r\n- **Brick-wall Limiter** — -3 dB threshold, 20:1 ratio, 1 ms attack\r\n- **Master Gain** — Global output volume\r\n- **FFT Analyser** — Waveform and frequency data for visualization\r\n\r\n### Arpeggiator\r\n- **Modes** — off, up, down, updown, random\r\n- **BPM-synced rates** — 1/4, 1/8, 1/8T, 1/16, 1/16T, 1/32\r\n- **Multi-octave** — Span 1–N octaves\r\n- **Gate** — Note length as fraction of step\r\n\r\n### Sound Library\r\n- **170+ Instrument Presets** via ChiptuneSoundFont — leads, bass, chords, arps, pads, synths, acoustic, retro, drums, FX\r\n- **15 Drum Kits**\r\n- **10 Game SFX Presets** — laser, coin, jump, explosion, powerup, hit, blip, bass, shoot, 1up\r\n- **Community Presets** — user-contributed via API\r\n\r\n### Integration\r\n- **MIDI Controller Support** — Velocity, CC, pitch bend, mod wheel, sustain pedal (Web MIDI API)\r\n- **SoundFont API** — Register external instrument libraries at runtime\r\n- **UMD Module** — Works in Node.js (CommonJS), AMD, and browser global\r\n\r\n---\r\n\r\n## Install\r\n\r\n**npm:**\r\n```bash\r\nnpm install @8bitforge/chiptune-synth\r\n```\r\n\r\n**CDN (recommended for browsers):**\r\n```html\r\n<!-- Engine -->\r\n<script src=\"https://cdn.chiptune-synth.8binami.com/3.0.0/chiptune-synth.min.js\"></script>\r\n<!-- Sound library (170+ instruments) -->\r\n<script src=\"https://cdn.chiptune-synth.8binami.com/3.0.0/chiptune-sound-font.min.js\"></script>\r\n```\r\n\r\n**unpkg:**\r\n```html\r\n<script src=\"https://unpkg.com/@8bitforge/chiptune-synth@3\"></script>\r\n```\r\n\r\n**ES Module / CommonJS:**\r\n```js\r\nimport ChiptuneSynth from '@8bitforge/chiptune-synth';\r\n// or\r\nconst ChiptuneSynth = require('@8bitforge/chiptune-synth');\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n### Play a game SFX\r\n```js\r\nconst synth = new ChiptuneSynth();\r\nawait synth.init();\r\nsynth.playPreset('laser');\r\n```\r\n\r\n### Load an instrument and play a note\r\n```js\r\nawait synth.init();\r\nsynth.loadInstrument('synthLead', 0);\r\nsynth.playNoteByName('C', 4, 0, 1.0);\r\n```\r\n\r\n### Enable MIDI controller\r\n```js\r\nconst devices = await synth.enableMIDI({\r\n    track: 0,\r\n    onConnect: (name) => console.log('Connected:', name),\r\n    onNoteOn:  (note, vel, ch) => console.log('Note on:', note, vel)\r\n});\r\n```\r\n\r\n### Add reverb + delay to a track\r\n```js\r\nsynth.setReverbMix(0, 0.3);      // 30% reverb\r\nsynth.setDelayTime(0, 0.375);    // dotted-8th delay\r\nsynth.setDelayFeedback(0, 0.5);\r\nsynth.setDelayMix(0, 0.25);\r\n```\r\n\r\n### Set up the arpeggiator\r\n```js\r\nsynth.setArpeggiator(0, { mode: 'up', rate: '1/16', octaves: 2, gate: 0.6 });\r\nconst noteId = synth.arpNoteOn(0, 261.63); // C4 — arp starts\r\n// later:\r\nsynth.arpNoteOff(0, 261.63);\r\n```\r\n\r\n### Mixer: pan and EQ a track\r\n```js\r\nsynth.setTrackPan(1, -0.5);           // Bass: left\r\nsynth.setTrackEQ(0, 'eqHigh', 4);     // Lead: +4dB highs\r\nsynth.setTrackFaderVolume(4, 0.8);    // Kick: fader at 80%\r\nsynth.setTrackMute(6, true);          // Hi-hat: muted\r\n```\r\n\r\n### Bitcrusher — retro lo-fi effect\r\n```js\r\nsynth.setBitcrusherBits(3, 6);    // FX track: 6-bit\r\nsynth.setBitcrusherRate(3, 0.3);  // Low sample rate\r\n```\r\n\r\n---\r\n\r\n## API Reference\r\n\r\n### Lifecycle\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `new ChiptuneSynth()` | Create a synth instance |\r\n| `synth.init()` | Initialize audio engine (async, requires user gesture) |\r\n| `synth.dispose()` | Release all audio resources |\r\n| `synth.resetToDefaults()` | Reset all tracks, mixer, and FX to factory settings |\r\n| `synth.bpm` | BPM used by arpeggiator (default: 120) |\r\n\r\n### Playing Notes\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.playNote(freq, track, duration?, startTime?)` | Play by frequency (Hz). Returns `noteId` |\r\n| `synth.playNoteByName(note, octave, track, duration?)` | Play by name e.g. `'C#', 5`. Returns `noteId` |\r\n| `synth.stopNote(noteId)` | Stop a sustained note with ADSR release |\r\n| `synth.stopAllNotes()` | Emergency stop — all notes + all arps |\r\n\r\n> **Sustained notes:** `duration >= 10` holds indefinitely. Call `stopNote(id)` to release.\r\n\r\n### SFX Presets\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.playPreset(name)` | Load preset config + play immediately |\r\n| `synth.loadPreset(name)` | Load preset config without playing |\r\n| `ChiptuneSynth.getPresetNames()` | Array of all SFX preset names |\r\n\r\n### Instrument Presets\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.loadInstrument(name, trackIndex)` | Load an instrument onto a track |\r\n| `ChiptuneSynth.getInstrumentNames()` | Array of all instrument keys |\r\n| `ChiptuneSynth.getInstruments()` | Full instrument definitions object |\r\n| `ChiptuneSynth.getInstrumentsByCategory()` | Instruments grouped by category |\r\n\r\n### Configuration\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.updateTrack(i, settings)` | Merge partial settings into track config |\r\n| `synth.updateEnvelope(i, env)` | Merge partial ADSR |\r\n| `synth.updateVibrato(i, vib)` | Update vibrato `{ rate, depth }` |\r\n| `synth.updateLiveNotes(i)` | Apply track changes to currently playing notes |\r\n| `synth.updatePitchBend()` | Push `synth.pitchBend` to active notes |\r\n| `synth.updateModulation()` | Push `synth.modulation` to active notes |\r\n\r\n**Track properties:** `type`, `volume`, `dutyCycle`, `pitchEnv`, `glide`, `detune`\r\n\r\n**Modulation properties (via `updateTrack`):**\r\n- `unisonVoices`, `unisonDetune`, `unisonSpread`\r\n- `filterEnabled`, `filterType`, `filterCutoff`, `filterQ`, `filterKeyTrack`\r\n- `filterEnvAmount`, `filterEnvAttack`, `filterEnvRelease`\r\n- `filterLfoRate`, `filterLfoDepth`, `lfoFilterRate`, `lfoFilterDepth`\r\n- `tremoloRate`, `tremoloDepth`\r\n- `octaveOffset`, `semitoneOffset`\r\n\r\n**Envelope properties:** `attack`, `decay`, `sustain`, `release`\r\n\r\n### Mixer Console\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.setTrackFaderVolume(i, vol)` | Channel fader 0–1.5 (1.0 = unity) |\r\n| `synth.setTrackPan(i, pan)` | Stereo pan -1 (left) to +1 (right) |\r\n| `synth.setTrackEQ(i, band, gainDb)` | `band`: `'eqLow'`, `'eqMid'`, `'eqHigh'` (±12 dB) |\r\n| `synth.setTrackSolo(i, bool)` | Solo a track |\r\n| `synth.setTrackMute(i, bool)` | Mute a track |\r\n| `synth.resetMixerToDefaults()` | Reset all mixer settings |\r\n| `synth.setTrackCompressorEnabled(i, bool)` | Enable/disable per-track compressor |\r\n| `synth.setTrackCompressorThreshold(i, dB)` | Threshold in dB |\r\n| `synth.setTrackCompressorRatio(i, ratio)` | Ratio e.g. 4 = 4:1 |\r\n| `synth.setTrackCompressorAttack(i, s)` | Attack in seconds |\r\n| `synth.setTrackCompressorRelease(i, s)` | Release in seconds |\r\n| `synth.getTrackCompressorReduction(i)` | Current gain reduction (dB) |\r\n| `synth.setMasterVolume(vol)` | Master output gain |\r\n| `synth.getMasterVolume()` | Current master volume |\r\n\r\n### Metering & Visualization\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.getAnalyserData()` | `Uint8Array` — waveform time-domain data |\r\n| `synth.getFrequencyData()` | `Uint8Array` — FFT frequency data |\r\n| `synth.getWaveformData()` | Alias for `getAnalyserData()` |\r\n| `synth.getTrackLevel(i)` | RMS level for track i (0–1) |\r\n| `synth.getMasterLevel()` | RMS level at master bus (0–1) |\r\n\r\n### Per-Track Effects\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.setDistortion(i, amount)` | Drive 0–1. 0 = bypass |\r\n| `synth.setDelayTime(i, seconds)` | Delay time 0–2s |\r\n| `synth.setDelayFeedback(i, amount)` | Feedback 0–0.9 |\r\n| `synth.setDelayMix(i, mix)` | Wet/dry 0–1 |\r\n| `synth.setReverbMix(i, mix)` | Wet/dry 0–1 |\r\n| `synth.setReverbDecay(i, decay)` | Reverb tail length |\r\n| `synth.setChorusRate(i, hz)` | LFO rate 0.1–10 Hz |\r\n| `synth.setChorusDepth(i, depth)` | Modulation depth 0–1 |\r\n| `synth.setChorusMix(i, mix)` | Wet/dry 0–1 |\r\n| `synth.setBitcrusherBits(i, bits)` | Bit depth 1–16. 16 = bypass |\r\n| `synth.setBitcrusherRate(i, rate)` | Sample rate ratio 0.01–1 |\r\n| `synth.getTrackFxParams(i)` | Get all FX params for a track |\r\n| `synth.loadFxPreset(i, name)` | Load FX preset: `'clean'` `'space'` `'echo'` `'dirty'` `'crush'` |\r\n| `ChiptuneSynth.getFxPresetNames()` | Array of FX preset names |\r\n\r\n### Arpeggiator\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.setArpeggiator(i, settings)` | Configure arp for track i |\r\n| `synth.getArpeggiator(i)` | Get current arp settings |\r\n| `synth.arpNoteOn(i, frequency)` | Trigger arp on a frequency. Returns `'arp'` if active |\r\n| `synth.arpNoteOff(i, frequency)` | Release a held note from the arp |\r\n| `synth.arpStopAll()` | Stop all active arpeggiatorsators |\r\n\r\n**Arp settings:**\r\n```js\r\n{\r\n    mode:   'up',   // 'off' | 'up' | 'down' | 'updown' | 'random'\r\n    rate:   '1/8',  // '1/4' | '1/8' | '1/8T' | '1/16' | '1/16T' | '1/32'\r\n    octaves: 2,     // 1–4 octave span\r\n    gate:    0.6    // Note length 0.0–1.0 (fraction of step)\r\n}\r\n```\r\n\r\n### MIDI\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `synth.enableMIDI(options?)` | Enable MIDI. Returns `Promise<string[]>` (device names) |\r\n| `synth.disableMIDI()` | Disconnect all MIDI |\r\n| `synth.setMIDITrack(i)` | Change target track |\r\n| `synth.setMIDIChannel(ch)` | Channel filter 0-15 (0 = all) |\r\n| `synth.isMIDIEnabled()` | Boolean |\r\n\r\n**`enableMIDI` options:**\r\n```js\r\nsynth.enableMIDI({\r\n    track: 0,\r\n    channel: 0,\r\n    onConnect:    (name) => {},\r\n    onDisconnect: (name) => {},\r\n    onNoteOn:     (note, velocity, channel) => {},\r\n    onNoteOff:    (note, channel) => {},\r\n    onCC:         (cc, value, channel) => {}\r\n});\r\n```\r\n\r\n**Supported MIDI messages:** Note On/Off (velocity), CC1 (mod wheel), CC7 (volume), CC64 (sustain), CC120/123 (all notes off), Pitch Bend\r\n\r\n### Static Utilities\r\n\r\n| Method | Description |\r\n|--------|-------------|\r\n| `ChiptuneSynth.noteToFrequency(note, octave)` | `'A', 4` → `440` |\r\n| `ChiptuneSynth.midiToFrequency(midi)` | `69` → `440` |\r\n| `ChiptuneSynth.frequencyToMidi(freq)` | `440` → `69` |\r\n| `ChiptuneSynth.TRACK_NAMES` | `['Lead','Harmony','Bass','Arp','Kick','Snare','Hi-hat','FX']` |\r\n| `ChiptuneSynth.NUM_TRACKS` | `8` |\r\n\r\n### SoundFont API\r\n\r\n```js\r\n// Register an external sound library at runtime\r\nChiptuneSynth.registerSoundFont({\r\n    name: 'My Library',\r\n    version: '1.0.0',\r\n    categories: {\r\n        leads: {\r\n            'my-lead': {\r\n                name: 'My Lead',\r\n                type: 'square', dutyCycle: 0.25, volume: 0.3,\r\n                envelope: { attack: 0.01, decay: 0.1, sustain: 0.7, release: 0.2 },\r\n                vibrato:  { rate: 5, depth: 8 }\r\n            }\r\n        }\r\n    }\r\n});\r\n\r\nChiptuneSynth.getSoundFonts();           // Registered font metadata\r\nChiptuneSynth.getKits();                 // All registered drum kits\r\nChiptuneSynth.getInstrumentsByCategory(); // Instruments grouped by category\r\n```\r\n\r\n---\r\n\r\n## Tracks\r\n\r\n| # | Name | Default Waveform | Envelope Character |\r\n|---|------|-----------------|-------------------|\r\n| 0 | Lead | Square 50% PWM | Attack 10ms, sustain |\r\n| 1 | Harmony | Square 25% PWM | Softer attack |\r\n| 2 | Bass | Triangle | Slow attack, long sustain |\r\n| 3 | Arp | Sawtooth | Very fast — tight arp steps |\r\n| 4 | Kick | Sine + pitch env | Punch, no sustain |\r\n| 5 | Snare | Noise | Short burst |\r\n| 6 | Hi-hat | Noise | Very short — tick |\r\n| 7 | FX | Square 12.5% PWM | Sweep, no sustain |\r\n\r\n---\r\n\r\n## Instrument Presets (built-in)\r\n\r\n| Key | Label | Waveform | Unison | Filter | Character |\r\n|-----|-------|----------|--------|--------|-----------|\r\n| `piano` | Piano | Triangle | 2v | LP 6kHz | Bright percussive keys |\r\n| `violin` | Violin | Sawtooth | 2v | LP 5kHz | Expressive bowed strings |\r\n| `cello` | Cello | Sawtooth | 2v | LP 3kHz | Deep warm strings |\r\n| `flute` | Flute | Sine | 1v | Off | Airy with tremolo |\r\n| `organ` | Organ | Square | 3v | LP 8kHz | Full drawbar |\r\n| `brass` | Brass | Sawtooth | 2v | LP 2.5kHz | Punchy with filter sweep |\r\n| `harmonica` | Harmonica | Square | 1v | LP 4kHz | Reedy with vibrato |\r\n| `synthLead` | Synth Lead | Square | 4v | LP 4kHz | Fat detuned lead |\r\n| `synthPad` | Synth Pad | Sawtooth | 8v | LP 3.5kHz | Lush evolving pad |\r\n| `synthBass` | Synth Bass | Sawtooth | 2v | LP 1.2kHz | Squelchy acid bass |\r\n| `marimba` | Marimba | Sine | 1v | Off | Woody mallet |\r\n| `electricGuitar` | Elec. Guitar | Square | 3v | LP 3.5kHz | Overdriven crunch |\r\n\r\n> Load the `ChiptuneSoundFont` library for 170+ additional presets across 10 categories.\r\n\r\n---\r\n\r\n## FX Presets\r\n\r\n| Name | Distortion | Delay | Reverb | Chorus | Crush |\r\n|------|-----------|-------|--------|--------|-------|\r\n| `clean` | 0% | 0% | 0% | 0% | 16-bit |\r\n| `space` | 0% | 30% | 50% | 20% | 16-bit |\r\n| `echo` | 0% | 50% | 20% | 0% | 16-bit |\r\n| `dirty` | 70% | 0% | 10% | 0% | 12-bit |\r\n| `crush` | 100% | 30% | 0% | 0% | 4-bit |\r\n\r\n---\r\n\r\n## Game SFX Presets\r\n\r\n| Preset | Track | Description |\r\n|--------|-------|-------------|\r\n| `laser` | FX | Fast descending square zap |\r\n| `coin` | Lead | Classic collect-item ding |\r\n| `jump` | Kick | Short pitch-up bloop |\r\n| `explosion` | Snare | Noise burst with slow decay |\r\n| `powerup` | FX | Rising sweep with vibrato |\r\n| `hit` | Snare | Quick damage impact |\r\n| `blip` | Lead | Tiny menu select beep |\r\n| `bass` | Bass | Deep triangle thump |\r\n| `shoot` | FX | Descending pew-pew |\r\n| `1up` | Lead | 3-note extra life arpeggio |\r\n\r\n---\r\n\r\n## Examples & Demo\r\n\r\n- **[Live Demo](https://chiptune-synth.8binami.com/)** — Full synth with keyboard, instruments, MIDI, and visualizer\r\n- **[Getting Started](https://chiptune-synth.8binami.com/examples/getting-started)**\r\n- **[Game SFX](https://chiptune-synth.8binami.com/examples/game-sfx)**\r\n- **[Melodies](https://chiptune-synth.8binami.com/examples/melody)**\r\n- **[Instruments](https://chiptune-synth.8binami.com/examples/instruments)**\r\n- **[Mini Game: Catcher](https://chiptune-synth.8binami.com/examples/mini-game)**\r\n- **[Mini Game: Platformer](https://chiptune-synth.8binami.com/examples/platformer)**\r\n- **[Soundboard](https://chiptune-synth.8binami.com/examples/soundboard)**\r\n- **[Sound Design](https://chiptune-synth.8binami.com/examples/sound-design)**\r\n\r\n---\r\n\r\n## License\r\n\r\nChiptuneSynth is a **source-sealed, freely distributable** audio library developed by [8Binami](https://8binami.com).\r\n\r\n**Free** if your revenue is under $100,000/year — with attribution:\r\n`\"Audio powered by ChiptuneSynth — 8Binami.com\"`\r\n\r\n**Always free** for open source projects (OSI-approved license, no attribution required).\r\n\r\n**Paid tiers** start at $149/year for commercial use above the free threshold.\r\nSee [8binami.com/pricing](https://8binami.com/pricing) or contact [hello@8binami.com](mailto:hello@8binami.com).\r\n\r\nSee [LICENSE](LICENSE) for full terms.\r\n\r\n---\r\n\r\nBuilt with care by [8Binami](https://8binami.com) · [8BitForge](https://8bitforge.com)\r\n","readmeFilename":"README.md"}