Skip to content

About

Zero-dependency procedural Web Audio API mechanical keyboard switch sound synthesizer (Thock, Clack, Clicky, Creamy, Marbly, Holy Panda)

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

mech-switch-synth 🎹

Zero-dependency procedural Web Audio API synthesizer for mechanical keyboard switch acoustics (thock, clack, clicky, creamy, marbly, holy-panda, typewriter, silent-tactile).

Extracted from Keyboard Cheat Codes (keyboardcheat.codes). Play realistic mechanical keystroke sounds in any web app, typing trainer, or terminal portfolio with 0 KB of audio file downloads.

✨ Features

  • Zero Audio Assets: 100% procedural synthesis via Web Audio API oscillators and bandpass filters.
  • 8 Built-in Switch Profiles: thock, clack, clicky, creamy, marbly, holy-panda, typewriter, and silent-tactile.
  • Key-Size Acoustic Scaling: Stabilized keys (Space, Enter, Shift, Backspace) automatically shift to deeper housing resonance frequencies.
  • Natural Micro-Jitter: Subtle per-keystroke pitch randomization prevents robotic repetition.
  • TypeScript Ready: Ships with full .d.ts type definitions.

📦 Installation

npm install mech-switch-synth

🚀 Quick Usage

import { createSwitchSynth } from "mech-switch-synth";

const synth = createSwitchSynth({
  defaultPreset: "thock",
  volume: 0.7
});

window.addEventListener("keydown", (event) => {
  if (!event.repeat) {
    synth.triggerKeydown({ key: event.key });
  }
});

// Switch acoustic profile dynamically:
synth.setPreset("creamy");

🤝 Contributing New Switch Profiles

We welcome community contributions for new mechanical switch presets (e.g., cherry-mx-brown, gateron-oil-king, topre-45g, alps-blue, buckling-spring)! Add an entry to SWITCH_PRESETS in index.js and run npm test.

📄 License

MIT © Kemal Codes (@techkayacodes)

About

Zero-dependency procedural Web Audio API mechanical keyboard switch sound synthesizer (Thock, Clack, Clicky, Creamy, Marbly, Holy Panda)

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages