Tidal struct to MIDI CCV (in Hydra)

Hi,

I've got a pattern to struct the rhythm of an instrument (see below)

do
    let p1 = "1*<2 4 6> [1 0] [1!<1> 0]"
    d1 $ str p1 $ n "bf1" #s "midi" #midichan 0
    d16 $ struct p1 $ ccv 127 #ccn 5 #s "midi"

I'm trying to feed the struct into Hydra using the hydra-midi extension. So that, when there's a 1 in the struct, the background looks red, else it looks black:
solid(cc(5), 0, 0).out()

At the moment, Hydra is red 100% of the time. I can write the pattern and multiply it by 127 inside ccv, and it works:
d16 $ ccv (p1 |* 127) #ccn 5 #s "midi"

Any idea to get struct to work? Thanks!

why wouldn't you use the note feature of the hydra-midi extension? you could use a different channel for "control" notes

just to be clear, struct is working perfectly, but you're just sending messages that set ccn 5 to 127. you need some way to set it to 0 with each note, you could use something like:

_trimcc :: Time -> ControlPattern -> ControlPattern
_trimcc r pat = squeezeJoin $ ((\p -> timeCat [(r,p),(1-r,(p # ccv 0))]) . pure) <$> pat

trimcc :: Pattern Time -> ControlPattern -> ControlPattern
trimcc = tParam _trimcc

d16 $ trimcc 0.5 $ struct p1 $ ccv 127 # ccn 5 #s "midi"

i haven't tested this but the functions does compile without errors