diff --git a/main.py b/main.py index 4990488..a337ff0 100644 --- a/main.py +++ b/main.py @@ -838,7 +838,18 @@ def main() -> int: except Exception as exc: logger.warning("Could not set CPU governor (non-root?): %s", exc) - import argparse + # Disable Python garbage collector to prevent 10-50ms GC pauses in + # the real-time audio callback. At ~500 numpy allocs/sec in the + # pipeline, default GC (threshold=700) triggers every ~1.4s, + # causing audible pops. Reference counting handles 99% of cleanup. + try: + import gc + gc.disable() + logger.info("GC disabled for RT audio stability") + except Exception as exc: + logger.warning("Could not disable GC: %s", exc) + + logger.info("Pedal v2 starting up...") parser = argparse.ArgumentParser( description="Pi Multi-FX Pedal — real-time guitar multi-effects",