Skip to main content

Mario sounds in Claude Code

W

When Claude finishes a long task, you get silence. That's fine, but there's a better option. Claude Code supports hooks, which are commands that fire on specific events. So I wired up Mario sounds you might know from my APEX Deployment Tool, and now I get a little coin chime when Claude is done, a warning tone when it's waiting for me, and a dying-mushroom sound right before it compacts the conversation.



Here's how to set it up.


Install chime

The chime Python library does all the work. One install, no system dependencies.

pip install chime


The script

Save this anywhere stable. I keep mine at "~/.claude/scripts/play_sound.py".

#!/usr/bin/env python3
import argparse
import chime

SOUNDS = {
    'success' : chime.success,
    'error'   : chime.error,
    'warning' : chime.warning,
    'info'    : chime.info,
}

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('sound', choices=SOUNDS.keys())
    parser.add_argument('--theme', default='chime', choices=chime.themes())
    args = parser.parse_args()

    chime.theme(args.theme)
    SOUNDS[args.sound](sync=True)

if __name__ == '__main__':
    main()


Quick test before you hook it up:

python3 play_sound.py success --theme mario


The hooks

Claude Code hooks live in "~/.claude/settings.json" for global scope, or ".claude/settings.json" inside your project. I use the global one so every Claude session gets the sounds automatically.

Add this under the hooks key:

{
  "hooks": {
    "Stop": [{
      "hooks": [{
        "type": "command",
        "command": "python3 /path/to/play_sound.py success --theme mario",
        "async": true
      }]
    }],
    "Notification": [{
      "hooks": [{
        "type": "command",
        "command": "python3 /path/to/play_sound.py warning --theme mario",
        "async": true
      }]
    }],
    "PreCompact": [{
      "hooks": [{
        "type": "command",
        "command": "python3 /path/to/play_sound.py error --theme mario",
        "async": true
      }]
    }]
  }
}


Three events, three sounds:

  • Stop fires when Claude finishes a turn. The coin chime, success. You know it's done.
  • Notification fires when Claude is waiting for your input. A warning tone so you don't keep it waiting.
  • PreCompact fires just before Claude compacts the context window. error here – not because anything went wrong, but it's the most dramatic Mario sound and context compaction does feel a bit dramatic and reminds me I have to double check the outputs when it is done.


The "async: true" flag is important. Without it, Claude would wait for the sound to finish before continuing, which you definitely don't want on every tool call.


Swap the theme

Don't care for Mario? Change "mario" to "zelda", "sonic", or "pokemon". A full afternoon of back-and-forth with Claude is a bit more fun when you hear a coin drop every time it wraps up.

If this put a smile on your face, share it with a colleague who lives in their Claude. Thanks!


Comments