I want to control the argument of segment
with MIDI input, but I am struggling to get the syntax right. I'm running into some type conversion issues.
Basic non-MIDI pattern:
d1 $ gain (segment 1 $ range 0.25 1 rand) # s "bd"
Then I try to replace the segment
argument with a MIDI pattern:
d1 $ gain (segment (range 1 8 $ (cF 0 "90")) $ range 0.5 1 rand) # s "bd"
But this throws an error:
• Couldn't match type ‘Double’ with ‘Ratio Integer’
Expected type: Pattern Time
Actual type: Pattern Double
• In the first argument of ‘segment’, namely
‘(range 1 8 $ (cF 0 "90"))’
In the expression: segment (range 1 8 $ (cF 0 "90"))
In the first argument of ‘gain’, namely
‘(segment (range 1 8 $ (cF 0 "90")) $ range 0.5 1 rand)’
I've tried casting the MIDI pattern to type Pattern Time
but it results in the same error:
d1
$ gain (segment ((range 1 8 $ (cF 0 "90")) :: Pattern Time ) $ range 0.5 1 rand)
# s "bd"
Any ideas?