Complete instructions for building the vinyl scratch removal library, LV2 plugin, and CLI tool.
- Prerequisites
- Quick Start
- Building the Core Library
- Building the LV2 Plugin
- Building the CLI Tool
- Testing
- Installation
- Troubleshooting
- Python 3.7+ with development headers
- GCC or compatible C compiler
- Cython (
pip install cython) - NumPy (
pip install numpy) - SciPy (
pip install scipy) - soundfile (
pip install soundfile)
- LV2 development headers (
lv2-devpackage on Debian/Ubuntu) - make
sudo apt update
sudo apt install python3-dev python3-pip gcc make lv2-dev libsndfile1-dev
pip3 install cython numpy scipy soundfilesudo dnf install python3-devel python3-pip gcc make lv2-devel libsndfile-devel
pip3 install cython numpy scipy soundfilesudo pacman -S python python-pip gcc make lv2 libsndfile
pip install cython numpy scipy soundfilebrew install python gcc make lv2 libsndfile
pip3 install cython numpy scipy soundfileBuild everything:
# 1. Build core library
cd core
python3 setup.py build_ext --inplace
cd ..
# 2. Build LV2 plugin (optional)
cd lv2
make
cd ..
# 3. Test CLI tool
chmod +x cli/vinyl
./cli/vinyl --helpThe core library is written in Cython and compiles to native Python extensions.
cd corepython3 setup.py build_ext --inplaceWhat this does:
- Compiles
detection.pyx→detection.so(or.pydon Windows) - Compiles
interpolation.pyx→interpolation.so - Compiles
vinyl_core.pyx→vinyl_core.so
python3 -c "import vinyl_core; print('Success!')"If you see "Success!", the build worked!
Debug build (with symbols):
python3 setup.py build_ext --inplace --debugOptimized build (default):
python3 setup.py build_ext --inplaceInstall system-wide (optional):
python3 setup.py installError: "Python.h not found"
# Ubuntu/Debian
sudo apt install python3-dev
# Fedora
sudo dnf install python3-develError: "numpy/arrayobject.h not found"
pip3 install numpyError: "Cython not found"
pip3 install cythonThe LV2 plugin is a compiled shared library that Audacity and other DAWs can load.
cd core
python3 setup.py build_ext --inplace
cd ..cd lv2makeWhat this does:
- Compiles
vinyl_scratch_removal.ctovinyl_scratch_removal.so - Creates
vinyl_scratch_removal.lv2/bundle with all required files - Copies manifest and TTL files
ls vinyl_scratch_removal.lv2/You should see:
vinyl_scratch_removal.so(compiled plugin)manifest.ttl(LV2 manifest)vinyl_scratch_removal.ttl(plugin description)
Install for current user:
make install PREFIX=$HOME/.localInstall system-wide:
sudo make installManual installation:
# Linux
mkdir -p ~/.lv2
cp -r vinyl_scratch_removal.lv2 ~/.lv2/
# macOS
mkdir -p ~/Library/Audio/Plug-Ins/LV2
cp -r vinyl_scratch_removal.lv2 ~/Library/Audio/Plug-Ins/LV2/- Restart Audacity
- Go to
Effect > Add/Remove Plugins - Enable "Vinyl Scratch Removal" if it appears
- Use from
Effect > Vinyl Scratch Removal
Error: "lv2/lv2plug.in/ns/lv2core/lv2.h: No such file"
# Ubuntu/Debian
sudo apt install lv2-dev
# Fedora
sudo dnf install lv2-devel
# macOS
brew install lv2Plugin doesn't appear in Audacity:
- Check installation path:
ls ~/.lv2/orls /usr/local/lib/lv2/ - Check Audacity's LV2 scan:
Tools > Plugin Manager - Try rescanning:
Tools > Plugin Manager > Rescan
The CLI tool is a Python script that uses the core library.
cd core
python3 setup.py build_ext --inplace
cd ..chmod +x cli/vinyl./cli/vinyl --helpYou should see the help message!
Install for current user:
cp cli/vinyl ~/.local/bin/
cp cli/vinyl_cli.py ~/.local/bin/Install system-wide:
sudo cp cli/vinyl /usr/local/bin/
sudo cp cli/vinyl_cli.py /usr/local/bin/# Basic usage
./cli/vinyl input.wav output.wav
# With options
./cli/vinyl input.wav output.wav --threshold 2.5 --mode aggressive
# Show help
./cli/vinyl --helpcd core
python3 << EOF
import numpy as np
from vinyl_core import VinylProcessor
# Create test audio with a click
audio = np.random.randn(44100).astype(np.float32) * 0.1
audio[1000:1005] = 1.0 # Add click
# Process
processor = VinylProcessor(44100.0, 3.0)
processed = processor.process(audio.copy())
print(f"Original peak at click: {audio[1000:1005].max()}")
print(f"Processed peak at click: {processed[1000:1005].max()}")
print("Test passed!" if processed[1000:1005].max() < 0.5 else "Test failed!")
EOF# Generate test file
python3 << EOF
import numpy as np
import soundfile as sf
# Create test audio
audio = np.random.randn(44100).astype(np.float32) * 0.1
audio[1000:1005] = 1.0 # Add click
sf.write('test_input.wav', audio, 44100)
print("Created test_input.wav")
EOF
# Process
./cli/vinyl test_input.wav test_output.wav
# Check output
python3 << EOF
import soundfile as sf
audio, sr = sf.read('test_output.wav')
print(f"Output peak: {audio.max()}")
print("Test passed!" if audio.max() < 0.5 else "Test failed!")
EOF
# Cleanup
rm test_input.wav test_output.wav# Check if plugin is recognized
lv2ls | grep vinyl
# OR use lv2info
lv2info http://github.com/anthropics/vinyl-scratch-removal1. Build everything:
# Core library
cd core && python3 setup.py build_ext --inplace && cd ..
# LV2 plugin
cd lv2 && make && cd ..
# CLI tool
chmod +x cli/vinyl2. Install:
# Core library (optional, for system-wide Python import)
cd core && python3 setup.py install && cd ..
# LV2 plugin (for Audacity)
cd lv2 && make install PREFIX=$HOME/.local && cd ..
# CLI tool (for command-line use)
mkdir -p ~/.local/bin
cp cli/vinyl ~/.local/bin/
cp cli/vinyl_cli.py ~/.local/bin/3. Update PATH (if needed):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcCore library:
pip3 uninstall vinyl-coreLV2 plugin:
cd lv2
make uninstall PREFIX=$HOME/.localCLI tool:
rm ~/.local/bin/vinyl
rm ~/.local/bin/vinyl_cli.py"Module not found" errors:
# Check Python can find modules
cd core
python3 -c "import sys; print(sys.path)"
# Ensure you're in the right directory
pwd # Should show .../vinyl-scratch-removal/"Permission denied" on CLI tool:
chmod +x cli/vinylSlow processing:
- Check you built with optimization:
python3 setup.py build_ext --inplace(no--debug) - Increase AR order cautiously:
--ar-order 30(higher = slower but better quality) - Use conservative mode for faster processing:
--mode conservative
High memory usage:
- Process smaller chunks
- Reduce AR order:
--ar-order 10
"Warning: Using deprecated NumPy API"
- Safe to ignore, works fine
"Compiler optimization flags"
- These are normal,
-O3optimization is good
macOS: "Library not loaded"
# Check library paths
otool -L core/vinyl_core.*.so
# May need to set DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATHWindows:
- Use Visual Studio compiler or MinGW
- May need to install Microsoft Visual C++ Build Tools
- Replace
.sowith.pydin commands
Modified Cython code (.pyx files):
cd core
python3 setup.py build_ext --inplace --forceModified C code (LV2 plugin):
cd lv2
make clean
makeModified Python code (CLI):
- No rebuild needed, just run!
Enable Cython debugging:
cd core
python3 setup.py build_ext --inplace --debug
gdb python3
> run -c "import vinyl_core"Check generated C code:
cd core
cython detection.pyx -a
# Creates detection.html showing Python/C interaction| Command | Purpose |
|---|---|
cd core && python3 setup.py build_ext --inplace |
Build core library |
cd lv2 && make |
Build LV2 plugin |
./cli/vinyl input.wav output.wav |
Process audio file |
make install PREFIX=$HOME/.local |
Install LV2 plugin |
python3 -c "import vinyl_core" |
Test core import |
lv2ls | grep vinyl |
Check LV2 plugin |
If you encounter issues:
- Check this document's troubleshooting section
- Ensure all prerequisites are installed
- Try a clean rebuild:
make clean && make - Check system logs for errors
- Open an issue on GitHub with:
- Operating system and version
- Python version (
python3 --version) - Complete error message
- Build commands you ran
Last Updated: 2025-11-08 Version: 1.0.0