-
I've learned that there's plenty of options to combine two patterns (squeeze, setOut, etc.), and after trying out every one of them, I still cannot find a way to fully replace the "left" pattern with the "right" pattern while keeping their context (i.e. gain, velocity, sound, etc.) intact. Let's say I start with For patterns with values, I run into the same problem: It seems like once a pattern has a null value (rest/silence), it cancels the event in the hap (is that the right terminology?) and thus cannot be modified with subsequent functions. Am I missing something here, or is this a missing piece of functionality? As a side note, I noticed that the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Yep, it seems to be a problem of how silence works. Let me trace the code to understand what happens here:
So because silence will return an empty array for any query (1), fmap won't get a chance to map over silenced time slices (2.3). I am curious about your (musical) use case because I haven't yet had the need to restructure a pattern like this. @yaxu I wonder if that limitation also applies to tidal. One possible way to fix this would be to change silence to return a special hap of type silence, which will be ignored by the output. With that, each slice of time would always be covered by a hap. |
Beta Was this translation helpful? Give feedback.
-
good catch, the documentation still needs some TLC! If you want to help out, feel free to send a PR. There are plenty of other things missing, see this list. |
Beta Was this translation helpful? Give feedback.
-
In Haskell there is Similarly we could add a function to Pattern in strudel that just returns its argument I think that would work for your example case but I have a feeling it's not really what you're getting at, when you mention the problem of losing context. For example: n("a ~").gain(1.1).every(3, setOut(n("b b"))) That would lose the final Yep @felixroos this is a problem in Tidal too: tidalcycles/Tidal#721 With a related issue around having 'structured silence', that is closed not because it's really solved but because boolean patterns offer a workaround: tidalcycles/Tidal#250 The problem is that a lot of the time, the current behaviour is what you want.. To the point that it's easy to forget about this issue. But still it, would be nice to have the option, if it doesn't over-complicate things. |
Beta Was this translation helpful? Give feedback.
In Haskell there is
const
which just returns it's first argument (in js that would be(a,b) => a
), allowing e.g.every 3 (const "d e f) "a ~"
.Similarly we could add a function to Pattern in strudel that just returns its argument
Pattern.prototype.replace = a => a
, then do"~ a2" .replace("g2 f2") .note() .piano() .out()
I think that would work for your example case but I have a feeling it's not really what you're getting at, when you mention the problem of losing context. For example:
That would lose the final
b
.. Because there are no events in the second half of the cycle to replace with the events in the 'b' pattern.Yep @felixroos this is …