Metadata-Version: 2.5
Name: sortvisualframes
Version: 0.1.0
Summary: Frame-by-frame sorting algorithm visualizer with real-time sound feedback
Project-URL: Homepage, https://github.com/smallaistudios/sortvisualframes
License: MIT
License-File: LICENSE
Requires-Python: >=3.8
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: sounddevice
Description-Content-Type: text/markdown

# sortvisualframes

Frame-by-frame sorting algorithm visualizer with real-time sound feedback.

Watch sorting algorithms animate as bar charts while each comparison plays a
pitch that corresponds to the value being touched. Built on `matplotlib` and
`sounddevice`.

## Install

```bash
pip install sortvisualframes
```

## Quick start

```python
from sortvisualframes import runsort, addsort
import random


def bubble(arr):
    for i in range(len(arr)):
        for j in range(len(arr) - 1 - i):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
            yield [j, j + 1], arr.copy()


addsort(bubble, "Bubble")
runsort("Bubble", random.sample(range(1, 33), 32))
```

A window opens showing the bars swap in real time, with a beep per
comparison whose frequency rises with the value.

## Writing your own algorithm

A sort function must:

1. Mutate a copy of the input array step by step.
2. `yield [indices...], arr.copy()` after each interesting change.
3. Register itself with `addsort(func, "Name")`.

```python
def my_sort(arr):
    # ...do work...
    yield [i], arr.copy()

addsort(my_sort, "MySort")
runsort("MySort", data)
```

See `examples/` for complete Bubble and Selection implementations.

## Requirements

- Python >= 3.8
- A working display / GUI backend for `matplotlib` (TkAgg, Qt, etc.)
- An audio output device for `sounddevice` (optional — mute by passing
  `play_beep=None` if you adapt `runsort`)

## License

MIT
