def y.ring
import emerging-ezaudio@0.4.0.0/src/mp3_enc.bend as Mp3Encimport Base
98# window the 512-slot ring in place: multiply by win and fold into 64 bins
99def y.ring(
100 win: List<&2, F32>, got: Yr, +head: U32, +k: U32, +ii: U32
101) -> Yr:
102 match win got:
103 case Nil{} yr:
104 yr
105 case +w <> tl Yr{x, bins}:
106 y.ring(tl, y.step(xs.of(Array.get(F32, x, ((head + k : U32) .&. 511 : U32))), bins, w, ii),
107 head, (k + 1 : U32), y.wrap(U32.is_eq(ii, 63), ii))