Manipulate gain function / print output?

#1

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…

Best,
Kenneth

0 Likes

#2

There is actually an inverse saw function already:

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

0 Likes

#3

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?

0 Likes

#4

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.

0 Likes

#5

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…

0 Likes