Metadata-Version: 2.4
Name: erting
Version: 0.1.1
Summary: AI-powered audio/video denoising tool with CLI, GUI, and web interface
Author: ErTing Contributors
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/cycleuser/ErTing
Project-URL: Repository, https://github.com/cycleuser/ErTing
Project-URL: Issues, https://github.com/cycleuser/ErTing/issues
Keywords: denoise,audio,noise-reduction,speech-enhancement,ai,modelscope
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Framework :: Flask
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: modelscope>=1.0
Requires-Dist: pydub>=0.25
Requires-Dist: flask>=3.0
Requires-Dist: flask-cors>=4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-mock>=3.0; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Provides-Extra: gui
Requires-Dist: tkinter-tooltip>=2.0; extra == "gui"
Dynamic: license-file

# ErTing - AI-Powered Audio/Video Denoising

A powerful, local-first audio/video denoising tool powered by AI. ErTing uses ModelScope's speech enhancement models to remove noise from your audio and video files, delivering clean, professional-quality output.

> **ErTing (耳听)** -- Hear clearly.

## Features

### Three Interfaces

- **CLI** - Full-featured command-line interface with unified flags
- **GUI** - Desktop Tkinter interface for easy point-and-click operation
- **Web** - Flask-based web interface for browser-based denoising

### Core Capabilities

- AI-powered noise suppression using ModelScope models
- Supports wide range of audio/video formats (MP3, WAV, MP4, AVI, MOV, M4A, FLAC, OGG, WMA, AAC)
- Automatic format conversion to 16kHz WAV for optimal processing
- Configurable output paths and model selection
- JSON output for automation workflows

## Requirements

- Python 3.10+
- [ModelScope](https://modelscope.cn/) package
- pydub for audio format conversion
- 2GB+ RAM recommended for model loading

## Installation

### Method 1: Install from PyPI

```bash
pip install erting
```

### Method 2: Install from Source

```bash
git clone https://github.com/cycleuser/ErTing.git
cd ErTing
pip install -e .
```

## Quick Start

### CLI Usage

```bash
# Basic denoising
erting input.mp3

# Specify output path
erting -o output_clean.wav input.mp3

# JSON output for scripting
erting --json input.mp3

# Verbose mode
erting -v input.mp3

# Quiet mode (minimal output)
erting -q input.mp3
```

### GUI Usage

```bash
erting-gui
```

### Web Interface

```bash
erting-web
```

Then open [http://localhost:5001](http://localhost:5001) in your browser.

## CLI Options

```
erting [-V] [-v] [-o PATH] [--json] [-q] input [options]

Positional Arguments:
  input                  Input audio/video file path

Options:
  -V, --version         Show version and exit
  -v, --verbose         Enable verbose output
  -o, --output PATH     Output file path
  --json                Output result as JSON
  -q, --quiet           Suppress non-essential output
  --model MODEL         ModelScope model name (default: iic/speech_zipenhancer_ans_multiloss_16k_base)
```

## Python API

```python
from erting.api import denoise_audio, ToolResult

result = denoise_audio(input_path="input.mp3")
print(result.success)    # True / False
print(result.data)      # {'input_path': ..., 'output_path': ...}
print(result.metadata)  # {'version': '0.1.0', 'model': ...}
```

## Agent Integration (OpenAI Function Calling)

ErTing exposes OpenAI-compatible tools for LLM agents:

```python
from erting.tools import TOOLS, dispatch

# Pass TOOLS to the OpenAI chat completion API
response = client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=TOOLS,
)

# Dispatch the tool call
result = dispatch(
    tool_call.function.name,
    tool_call.function.arguments,
)
```

## Supported Formats

| Format | Extension | Notes |
|--------|-----------|-------|
| WAV | .wav | Direct processing |
| MP3 | .mp3 | Direct processing |
| MP4 | .mp4 | Audio extracted |
| AVI | .avi | Audio extracted |
| MOV | .mov | Audio extracted |
| M4A | .m4a | Direct processing |
| FLAC | .flac | Direct processing |
| OGG | .ogg | Direct processing |
| WMA | .wma | Direct processing |
| AAC | .aac | Direct processing |

## Project Structure

```
ErTing/
├── pyproject.toml              # Package metadata & build config
├── README.md                   # This file
├── LICENSE                     # GPL-3.0-or-later
├── erting/
│   ├── __init__.py             # Package init
│   ├── __version__.py          # Version
│   ├── __main__.py             # python -m erting entry
│   ├── core.py                 # Audio processing engine
│   ├── cli.py                  # CLI with unified flags
│   ├── gui.py                  # Tkinter GUI
│   ├── web.py                  # Flask web app
│   ├── api.py                  # ToolResult API
│   ├── tools.py                # OpenAI function-calling tools
│   └── templates/
│       └── index.html           # Web UI template
├── tests/
│   ├── __init__.py
│   ├── conftest.py             # Test fixtures
│   ├── test_core.py            # Core module tests
│   ├── test_api.py              # API tests
│   ├── test_tools.py           # Tools schema tests
│   └── test_cli.py             # CLI integration tests
└── scripts/
    ├── publish.sh               # PyPI publish script
    └── publish.bat              # Windows publish script
```

## Testing

```bash
# Run all tests
python -m pytest tests/ -v

# Run specific test file
python -m pytest tests/test_api.py -v

# Run with coverage
python -m pytest tests/ --cov=erting --cov-report=term-missing
```

## Publishing to PyPI

```bash
# Linux/macOS
./scripts/publish.sh

# Windows
scripts\publish.bat
```

Or manually:

```bash
rm -rf dist/
python -m build
twine upload dist/*
```

## Development

```bash
# Install dev dependencies
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Format code
ruff format .

# Lint
ruff check .

# Type check
mypy erting/
```

## License

GPL-3.0-or-later. See [LICENSE](LICENSE) for details.
