Metadata-Version: 2.4
Name: Music-Upsacler-and-Visualizer
Version: 0.1.0
Summary: An automated pipeline to download, upscale audio (Demucs, DeepFilterNet, AudioSR) and generate visualizations.
Author-email: mariobx <mario@example.com>
License: MIT License
        
        Copyright (c) 2026 Mario Marku
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: <3.12,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: yt-dlp
Requires-Dist: pedalboard
Requires-Dist: numpy<2.0
Requires-Dist: soundfile
Requires-Dist: torch==2.1.2
Requires-Dist: torchaudio==2.1.2
Requires-Dist: torchvision==0.16.2
Requires-Dist: GitPython
Requires-Dist: demucs
Requires-Dist: DeepFilterNet
Requires-Dist: audiosr
Dynamic: license-file

# Music Upscaling & Visualization

An automated pipeline that downloads audio from YouTube, upscales it using Demucs, DeepFilterNet, and AudioSR, and generates side-by-side comparison visualizations.

## Prerequisites

- **FFmpeg**: Must be installed and available in your `PATH`.
- **C Compiler**: `cc` (Linux) or `cl.exe` (Windows/MSVC) for building the visualizer.
- **Python 3.11**: **Required.** This project relies on specific versions of `torchaudio` and `DeepFilterNet` that have compatibility issues with Python 3.12+.
- **X11 Libraries**: (Linux only) Required for building the visualizer (Musializer).
  - On Debian/Ubuntu: `sudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev`

## Installation

```bash
pip install Music-Upsacler-and-Visualizer
```

*Note: It is highly recommended to use a virtual environment with Python 3.11.*

## Setup

The visualization component (Musializer) needs to be compiled locally.

1. The tool will automatically clone the musializer repository if it's not present when you run it, or you can do it manually:
   ```bash
   git clone https://github.com/mariobx/musializer-file-paths
   ```

2. Compile the binary:
   - **Linux**: `cd musializer-file-paths && cc -o nob nob.c && ./nob`
   - **Windows (MSVC)**: `cd musializer-file-paths && cl.exe nob.c && nob.exe`

The tool expects the binary at `./musializer-file-paths/build/musializer` by default, or you can specify the path using `--musializer_dir`.

## Usage

After installation, you can use the `musicupscaler` command:

```bash
musicupscaler <YOUTUBE_URL>
```

### Options:
- `-f`, `--format`: Audio format to download (`mp3`, `m4a`, `wav`, `flac`) (default: `mp3`).
- `-t`, `--threads`: Number of threads for upscaling.
- `--to_upscale`: Directory for initial downloads.
- `--post_upscaled`: Directory for upscaled audio.
- `--final_video_dir`: Directory for the final comparison video.
- `--musializer_dir`: Path to the compiled Musializer directory.

## How it Works

1. **Download**: Uses `yt-dlp` to fetch the highest quality audio.
2. **Upscale**:
   - **Demucs**: Separates audio into stems.
   - **DeepFilterNet**: Denoises the vocal stem.
   - **AudioSR**: Performs Super-Resolution (48kHz).
   - **Pedalboard**: Mixes, masters, and applies stereo widening.
3. **Visualize**: Uses a custom build of Musializer to generate waveforms.
4. **Stitch**: FFmpeg creates a side-by-side "BEFORE" vs "AFTER" comparison video.

---
Created by [mariobx](https://github.com/mariobx)
