Skip to content

About

NMF, RPCA, HPSS and spectral-dynamics experiments for analysing and reconstructing complex audio

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Audio Signal Processing Tools

Experimental Python tools for exploring how spectral structure can be learned, separated and reshaped in difficult audio. I built these while investigating music reconstruction from multichannel mixes and the relationship between low-rank, sparse, harmonic and percussive components.

The scripts produce playable WAV or FLAC results: reconstructed multichannel audio, harmonic-only signals, NMF-based spectral mosaics, and dynamically flattened audio created by a spectral-power compressor. The interesting part is that each result comes from a compact, inspectable numerical method rather than an opaque end-to-end application.

What is here

Script Experiment
nmf_purification.py Learn a spectral dictionary from reference audio and project a multichannel isolate onto it.
rpca_purification.py Decompose magnitude spectrograms into low-rank and sparse terms with inexact ALM.
hpss_purification.py Retain the harmonic component of mono or multichannel audio with HPSS.
nmf_hallucinate.py Reconstruct one signal through spectral signatures learned from another.
spectral_power_compressor.py Apply one coherent, smoothed gain curve derived from summed multichannel STFT power.
test_reconstruction.py Run the NMF and RPCA reconstruction paths on a user-supplied audio segment.

These are the original research implementations. They are intentionally small and direct, and their assumptions remain visible in the code. They are not presented as state-of-the-art source-separation methods.

Quick start

Create an environment and install the numerical-audio dependencies:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

Run the spectral-power compressor on your own audio:

python spectral_power_compressor.py input.wav output.wav --alpha 0.7

Run the combined reconstruction experiment:

python test_reconstruction.py \
  --isolate multichannel_isolate.wav \
  --reference reference_music.wav \
  --output-dir outputs \
  --offset 0 \
  --duration 20

The NMF and RPCA scripts can also be called independently. Use --help on a script to see its accepted paths and parameters.

Technical notes

  • Audio is analysed with short-time Fourier transforms and reconstructed with the original phase.
  • NMF learns non-negative spectral basis vectors from reference audio and estimates new activations for each target channel.
  • RPCA treats recurring spectral structure as low-rank and transient structure as sparse.
  • HPSS uses median-filtered harmonic/percussive masks.
  • The compressor detects energy in the spectral domain but applies a single overlap-added gain envelope to every channel, preserving the channel image.

The output quality depends strongly on the source material and parameters. These scripts document working research directions and their limitations; weak results are not hidden or treated as a reason to replace the methods.

Public boundary

This repository contains first-party algorithm implementations only. It does not include recordings, film or music assets, generated outputs, model weights, project-specific experiment drivers, or wrappers around third-party separation models. Supply only audio that you have the right to process.

Verification

The public export was checked with Python compilation and synthetic-audio smoke tests. No copyrighted source audio is required for those checks.

About

NMF, RPCA, HPSS and spectral-dynamics experiments for analysing and reconstructing complex audio

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages