Projects · Tools & libraries
X11 Mic Monitor
A small Python program for X11 and PipeWire, which plays back the current microphone input with a bit of delay while a mouse button is held, or records you and plays it straight back. Used for testing how my voice sounds before I say something.

root = x11.XDefaultRootWindow(dpy) bits = (ctypes.c_ubyte * 3)() for evtype in (XI_RAW_BUTTON_PRESS, XI_RAW_BUTTON_RELEASE): bits[evtype >> 3] |= 1 << (evtype & 7) mask = XIEventMask(XI_ALL_MASTER_DEVICES, len(bits), bits) xi.XISelectEvents(dpy, root, ctypes.byref(mask), 1) any_modifier = XIGrabModifiers(XI_ANY_MODIFIER, 0)
A simple project I've quickly made that I use for testing how my voice sounds to other people before I actually say anything in games.
- Hold Mouse5 to hear yourself half a second late, or Mouse5 with Mouse4 to hear yourself with no delay.
- Hold Windows+Mouse5 to record, and it plays back as soon as you let go.
- The buttons are grabbed through XInput 2, so other windows never see Mouse5, and a fullscreen game holding the pointer doesn't stop it.
- It only wakes on mouse buttons, and the PipeWire stream (
pw-loopback,pw-record,pw-play) exists only while it's in use.