Trouble with MIDI CCV


I am new to TidalCycles. Been working on it for a few weeks. So far the tutorials at have been great. However, I have run into some issues while exploring MIDI. Specifically this code:

d2 $ gain "1*16" # ccv (scale 30 90 $ slow 2 sine) # ccn 78 # s "midi" # midichan 12

I get the following error:

* Couldn't match expected type `Pattern Double -> Pattern Double'
              with actual type `Pattern Double'
* The first argument of ($) takes one argument,
  but its type `Pattern Double' has none
  In the first argument of `ccv', namely
    `(scale 30 90 $ slow 2 sine)'
  In the second argument of `(#)', namely
    `ccv (scale 30 90 $ slow 2 sine)'

It seems I run into a problem when attempting to do anything beyond a simple integer with ccv. This evaluates successfully without error:

once $ ccv 90 # ccn 78 # s "midi" # midichan 12

I don't know how to check the TidalCycles version I have installed. However I can confirm I am running GHCi, version 8.4.3 if that helps.

Any thoughts? Looking forward to engaging y'all as I progress. :slight_smile:

It looks like the issue here may lie with the scale function. Are your trying to get notes in a musical scale? Or is your goal to range the sine oscillator from 30 to 90?

1 Like

Main reason being, scale requires a string argument for the scale referenced, if that is the case. If you are just putting a range on the oscillation of sine, you should be able to use:

d2 $ gain "1*16" # ccv (range 30 90 $ slow 2 sine) # ccn 78 # s "midi" # midichan 12

There's a list of accepted scale on the Tidal site as well:

Hope this helps :slight_smile:

1 Like

Oh! So simple. I clearly have much to learn. Thanks @lannzach for the help.