Manipulate gain function / print output?

Hi all, first time poster here! Trying to wrap my head around how tidalcycles work, and it would be absolutely fantastic if there would be a way to get some feedback on what the functions actually do, something along the lines of .postln or .poll in sclang. For example, right now I’m mucking around with gain, trying to scale the gain. What I’m trying to accomplish in this particular case is to reverse the saw, i.e. going from 1 to 0 instead of 0 to 1. Original code:

p "sn" $ s "sn(15, 16)" # n (run 8) gain saw

My attempt at reversing saw:

p "sn" $ s "sn(15, 16)" # n (run 8) gain saw * (-1) + 1

It changes the sound, but not in the way I would expect…


There is actually an inverse saw function already:

isaw :: (Fractional a, Real a) => Pattern a
isaw = (1-) <$> saw

Thanks! Very useful :slight_smile:

However, I am still wondering if there is a way to print the output of what I’m doing, or is this anathema to the whole functional programming idea?

This is kind of a hack but if you evaluate the following from you editor it should print the values of saw to the terminal so you can inspect them: note ("1*8" * saw) Its not a nice UI but you can get a sense of whats going on.

Thanks for that! Will give it a spin when I have a bit more time on my hands. It’s a bit of a shame that there is no native way of getting numerical output from tidal, seeing as this is kind of one of the most basic resources for debugging code and all…