File size: 1,326 Bytes
09fa60b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# AudioForge Backend

FastAPI backend for open-source music generation.

## Setup

1. Install dependencies:
```bash

uv venv

source .venv/bin/activate  # Windows: .venv\Scripts\activate

uv pip install -e ".[dev]"

```

2. Set up environment variables:
```bash

cp .env.example .env

# Edit .env with your settings

```

3. Start PostgreSQL and Redis (using Docker):
```bash

docker-compose up -d postgres redis

```

4. Run migrations:
```bash

alembic upgrade head

```

5. Start the server:
```bash

uvicorn app.main:app --reload

```

## Music Generation Models

### MusicGen (Required)
MusicGen is used for instrumental music generation. It will be automatically downloaded on first use.

### Bark (Optional)
Bark is used for vocal generation. To install:

```bash

pip install bark

```

Or use the Hugging Face transformers version:
```bash

pip install transformers[torch] soundfile

```

Then update `app/services/vocal_generation.py` to use the transformers-based implementation.

## API Documentation

Once running, visit:
- Swagger UI: http://localhost:8000/api/docs
- ReDoc: http://localhost:8000/api/redoc

## Testing

```bash

pytest tests/ -v

```

## Development

```bash

# Format code

make format



# Type check

make type-check



# Lint

make lint

```