Files
product-vamp/generator/solo/policy.py
T
khodowany 75655786e9
ci / checks (push) Successful in 1h9m55s
Soloing
2026-10-01 08:35:12 -05:00

29 lines
968 B
Python

"""One curated, deterministic composition policy; all times are quarter-note beats."""
from __future__ import annotations
import dataclasses
import hashlib
import json
@dataclasses.dataclass(frozen=True)
class Policy:
acoustic_activity: float = 1.125
electric_activity: float = 1.375
active_occupancy: float = 0.75
arrival_occupancy: float = 0.9
weights: tuple[tuple[str, float], ...] = (('activity', 4), ('occupancy', 4), ('fidelity', 3), ('landmarks', 3), ('register', 1), ('contour', 1), ('connection', 1), ('repetition', 1), ('movement', 0.5))
beam_width: int = 64
extensions: int = 32
retrieval: int = 32
alternatives: int = 4
DEFAULT = Policy()
def describe():
values = dataclasses.asdict(DEFAULT)
identity = hashlib.sha256(json.dumps(values, sort_keys=True).encode()).hexdigest()
return {'fingerprint': identity, 'parameters': values}
def stable_rank(seed, value):
return hashlib.sha256((seed + repr(value)).encode()).hexdigest()