# Compact Sets

A rational theory of harmony based on Michael Winter's theory of conjunct connected sets in harmonic space, combining ideas from Tom Johnson, James Tenney, and Larry Polansky.

## Installation

```bash
# Activate virtual environment
source venv/bin/activate

# Run
python compact_sets.py --dims 4 --chord-size 3
```

## CLI Options

- `--dims 4|5|7|8` - Number of prime dimensions (default: 7)
- `--chord-size 3|4` - Size of chords (default: 3)
- `--symdiff-min`, `--symdiff-max` - Symmetric difference range (default: 2-2)
- `--melodic-min`, `--melodic-max` - Voice movement thresholds in cents
- `--dca` - DCA multiplier (default: 2.0)
- `--seed` - Random seed (default: random)
- `--cache-dir` - Graph cache directory (default: ./cache)
- `--output-dir` - Output directory (default: output)
- `--rebuild-cache` - Force rebuild graph
- `--no-cache` - Disable caching

## Legacy

The `legacy/` folder contains earlier versions of this code, used to create the musical works published at [unboundedpress.org/works/compact_sets_1_3](https://unboundedpress.org/works/compact_sets_1_3).

## Output

Generated files go to `output/`:
- `output_chords.json` - Chord data
- `output_chords.txt` - Human-readable chords
- `output_frequencies.txt` - Frequencies in Hz
