babysor/MockingBird · error · ModuleNotFoundError

Package 'webrtcvad' not found. This package enables noise re

Error message

Package 'webrtcvad' not found. This package enables noise removal and is recommended. Please install and try again. If installation fails, use --no_trim to disable this error message.

What it means

Raised by the vocoder preprocessing CLI when the webrtcvad package cannot be imported. VAD trimming is optional; the check is skipped when --no_trim is passed. Any import error (missing package or broken native extension) triggers this ModuleNotFoundError.

Source

Thrown at control/cli/vocoder_preprocess.py:53

    args = parser.parse_args()
    print_args(args, parser)
    modified_hp = hparams.parse(args.hparams)
    
    if not hasattr(args, "in_dir"):
        args.in_dir = os.path.join(args.datasets_root, "SV2TTS", "synthesizer")
    if not hasattr(args, "out_dir"):
        args.out_dir = os.path.join(args.datasets_root, "SV2TTS", "vocoder")

    if args.cpu:
        # Hide GPUs from Pytorch to force CPU processing
        os.environ["CUDA_VISIBLE_DEVICES"] = ""
    
    # Verify webrtcvad is available
    if not args.no_trim:
        try:
            import webrtcvad
        except:
            raise ModuleNotFoundError("Package 'webrtcvad' not found. This package enables "
                "noise removal and is recommended. Please install and try again. If installation fails, "
                "use --no_trim to disable this error message.")
    del args.no_trim

    run_synthesis(args.in_dir, args.out_dir, args.model_dir, modified_hp)

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. pip install webrtcvad
  2. Run with --no_trim to disable VAD trimming
  3. Use pip install webrtcvad-wheels as a drop-in on unsupported Python versions

Example fix

# before
python vocoder_preprocess.py datasets/SV2TTS/synthesizer
# after
python vocoder_preprocess.py datasets/SV2TTS/synthesizer --no_trim
Defensive patterns

Strategy: validation

Validate before calling

try:
    import webrtcvad  # noqa: F401
    HAS_VAD = True
except ImportError:
    HAS_VAD = False

if not HAS_VAD and not args.no_trim:
    raise SystemExit('webrtcvad missing; pass --no_trim or pip install webrtcvad')

Try / catch

try:
    import webrtcvad
except ImportError as e:
    raise RuntimeError('Install webrtcvad or pass --no_trim') from e

Prevention

When it happens

Trigger: Running vocoder_preprocess.py without --no_trim in an environment lacking a working webrtcvad install.

Common situations: Partial requirements installation; webrtcvad source build failing on systems without gcc/python headers; CI images without build toolchain.

Related errors


AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27). Data as JSON: /api/errors/7bfe4b70ad265f3e. Report an issue: GitHub.