Skip to content
krank56Public

About

Mechanical keyboard sound simulator with ultra-low latency (<10ms) - Built with Zig + Go

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

23 Commits

Folders and files

Repository files navigation

๐ŸŽน BuckleZig

Mechanical Keyboard Sound Simulator for macOS

BuckleZig adds authentic mechanical keyboard sounds to any keyboard, giving your typing that satisfying click-clack feedback. Built with Zig for ultra-low latency audio (<10ms) and Go for a beautiful terminal UI.

Version Platform License

โœจ Features

  • ๐ŸŽต System-wide keyboard capture - Works in every application
  • โšก Ultra-low latency - <10ms from keypress to sound (~7-9ms achieved)
  • ๐ŸŽจ Multiple Sound Profiles - Support for unlimited custom profiles
  • ๐ŸŽš๏ธ Real-time Volume Control - Adjust on-the-fly with visual feedback
  • ๐Ÿš€ Instant Profile Switching - Hot-swap sounds without interruption
  • ๐Ÿ’พ Persistent Config - Your preferences are automatically saved
  • ๐Ÿ“ฆ Vim-style Navigation - Efficient keyboard-driven UI
  • ๐Ÿ–ฅ๏ธ Beautiful TUI - Powered by BubbleTea

๐Ÿ“ธ Screenshot

๐ŸŽน BuckleZig - Mechanical Keyboard Sounds

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Active Profile: Cream             โ”‚
โ”‚ Volume: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ 80%            โ”‚
โ”‚ Sounds Played: 1,234              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Profiles:                         โ”‚
โ”‚                                   โ”‚
โ”‚   Cardboard                       โ”‚
โ”‚ โ–ธ Cream           [ACTIVE]        โ”‚
โ”‚   Crystal Purple                  โ”‚
โ”‚   Japanese Black                  โ”‚
โ”‚   Milky Yellow                    โ”‚
โ”‚   Oreo                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ— Ready - Keyboard capture active!

j/k: Navigate  โ€ข  Enter: Select Profile  โ€ข  +/-: Volume  โ€ข  q: Quit

๐Ÿš€ Quick Start

Prerequisites

  • macOS 10.15+ (Catalina or later)
  • Zig 0.11+ (for building from source)
  • Go 1.21+ (for building from source)

Installation

# Clone the repository
git clone https://github.com/yourusername/bucklezig.git
cd bucklezig

# Build the application
make build

# Run BuckleZig
./bucklezig

โš ๏ธ Sound Profiles Setup (Required)

Audio profiles are not included in this repository due to licensing compatibility with GNU GPL. You must add them manually:

  1. Create the profiles directory structure:

    mkdir -p profiles/{Cream,Cardboard,"Crystal Purple","Japanese Black","Milky Yellow",Oreo}
  2. Add your sound files:

    • Each profile directory needs 256 WAV files (16-bit, 44.1kHz recommended)
    • Files must be named: 1-down.wav, 1-up.wav, 2-down.wav, 2-up.wav, ..., 128-down.wav, 128-up.wav
    • X-down.wav = key press sound for keycode X
    • X-up.wav = key release sound for keycode X
  3. Example structure:

    profiles/
    โ”œโ”€โ”€ Cream/
    โ”‚   โ”œโ”€โ”€ 1-down.wav
    โ”‚   โ”œโ”€โ”€ 1-up.wav
    โ”‚   โ”œโ”€โ”€ 2-down.wav
    โ”‚   โ””โ”€โ”€ ... (256 files total)
    โ”œโ”€โ”€ Cardboard/
    โ””โ”€โ”€ ... (other profiles)
    
  4. Where to get sounds:

    • Record your own mechanical keyboard
    • Use royalty-free sound libraries
    • Create synthetic sounds with audio software
    • Ensure you have proper licensing rights for any sounds you use

Note: BuckleZig will not start without at least one complete profile directory.

First Launch

  1. Grant Accessibility Permissions (required for keyboard capture)

    • Go to System Preferences โ†’ Security & Privacy โ†’ Privacy โ†’ Accessibility
    • Click the lock icon and authenticate
    • Add your terminal app (Terminal.app, iTerm2, etc.) to the list
  2. Start Typing!

    • Type anywhere on your system to hear keyboard sounds
    • The default "Cream" profile loads automatically

๐ŸŽฎ Usage

Keybindings

Key Action
j / โ†“ Navigate down in profile list
k / โ†‘ Navigate up in profile list
Enter / Space Activate selected profile
+ / ] Increase volume (10% increments)
- / [ Decrease volume (10% increments)
q / Ctrl+C Quit application

Switching Profiles

  1. Press j or k to navigate through the profile list
  2. Press Enter to activate the selected profile
  3. Your selection is automatically saved

Adjusting Volume

  1. Press + to increase volume
  2. Press - to decrease volume
  3. Watch the visual volume bar update
  4. Volume is automatically saved

๐Ÿ“ Project Structure

bucklezig/
โ”œโ”€โ”€ zig/                    # Zig audio engine (performance-critical)
โ”‚   โ”œโ”€โ”€ src/audio/          # Audio playback, WAV loader, mixer
โ”‚   โ”œโ”€โ”€ src/keyboard/       # System-wide keyboard capture
โ”‚   โ””โ”€โ”€ src/profile/        # Profile loading and management
โ”œโ”€โ”€ go/                     # Go TUI (user interface)
โ”‚   โ”œโ”€โ”€ cmd/bucklezig/      # Main entry point
โ”‚   โ””โ”€โ”€ internal/
โ”‚       โ”œโ”€โ”€ tui/            # BubbleTea interface
โ”‚       โ”œโ”€โ”€ bridge/         # CGO bridge to Zig
โ”‚       โ””โ”€โ”€ config/         # Configuration persistence
โ””โ”€โ”€ profiles/               # Sound profile WAV files
    โ”œโ”€โ”€ Cream/
    โ”œโ”€โ”€ Cardboard/
    โ”œโ”€โ”€ Crystal Purple/
    โ”œโ”€โ”€ Japanese Black/
    โ”œโ”€โ”€ Milky Yellow/
    โ””โ”€โ”€ Oreo/

๐Ÿ› ๏ธ Development

Build Commands

# Clean build artifacts
make clean

# Build everything (Zig library + Go app)
make build

# Run tests
cd zig && zig build test      # Zig unit tests
cd go && go test ./...        # Go unit tests

# Format code
zig fmt zig/src/**/*.zig      # Zig formatting
cd go && gofmt -w .           # Go formatting

Architecture

BuckleZig uses a hybrid architecture:

  • Zig handles performance-critical audio and keyboard capture
  • Go provides the TUI and application logic
  • CGO bridges the two with minimal overhead

See ARCHITECTURE.md for detailed technical documentation.

๐ŸŽฏ Performance

BuckleZig meets all its performance targets:

Metric Target Achieved Status
Audio Latency <10ms ~7-9ms โœ…
Profile Switch <200ms Instant โœ…
Startup Time <500ms ~150ms โœ…
Memory Usage <100MB ~50-80MB โœ…
CPU Idle <1% <1% โœ…

๐Ÿ› Troubleshooting

No Sound When Typing

  • Verify system audio is working
  • Check volume isn't at 0% (press + to increase)
  • Ensure profiles directory exists with sound files: ls -la profiles/
  • Verify at least one complete profile with 256 WAV files is present

"Failed to start keyboard capture"

This means accessibility permissions aren't granted:

  1. System Preferences โ†’ Security & Privacy โ†’ Privacy โ†’ Accessibility
  2. Add your terminal app to the list
  3. Restart BuckleZig

Application Crashes

  • Rebuild with: make clean && make build
  • Check for error messages in terminal
  • Verify macOS version is 10.15+

See MANUAL_TEST.md for detailed troubleshooting.

๐Ÿ“š Documentation

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Follow the code style guidelines in AGENTS.md
  2. Add tests for new features (80% coverage minimum)
  3. Ensure all performance targets are met
  4. Update documentation as needed

๐Ÿ“ License

MIT License - See LICENSE file for details

๐Ÿ™ Acknowledgments

  • Sound profiles inspired by popular mechanical keyboard switches
  • Built with BubbleTea TUI framework
  • Audio engine powered by Zig's excellent cross-platform capabilities
  • Developed with assistance from OpenCode and Claude Sonnet 4.5

๐Ÿ‘ค Author

Created by @krank56

๐Ÿ—บ๏ธ Roadmap

  • Linux support (evdev keyboard capture)
  • Windows support
  • Custom profile creator
  • Per-key sound customization
  • Audio effects (reverb, EQ, compression)
  • Profile import/export
  • Community profile sharing

Made with โค๏ธ and Zig

About

Mechanical keyboard sound simulator with ultra-low latency (<10ms) - Built with Zig + Go

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages