Barrot-Omega-v2 / modules /rhythm_engine.py
scribedpengenius
Add safe Barrot bootstrap bundle
e6b0225
Raw
History Blame Contribute Delete
422 Bytes
def interval_vector_from_hits(pattern: str):
hits = [i for i, ch in enumerate(pattern) if ch == "x"]
if len(hits) < 2:
return []
return [hits[i+1] - hits[i] for i in range(len(hits)-1)]
def groove_analysis(pattern: str):
vec = interval_vector_from_hits(pattern)
return {
"pattern": pattern,
"interval_vector": vec,
"complexity_score": len(set(vec)) if vec else 0
}