Difference between revisions of "compress"

From TidalCycles userbase
Jump to: navigation, search
(Created page with "Type: <source inline> compress :: (Time, Time) -> Pattern a -> Pattern a </source> '''compress''' takes a pattern and ''squeezes'' it within the specified...")
 
(syntax highlight on type)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Type signatures|Type]]: <source inline> compress :: (Time, Time) -> Pattern a -> Pattern a </source>
+
[[Type signatures|Type]]: <syntaxhighlight lang="haskell" inline> compress :: (Time, Time) -> Pattern a -> Pattern a </syntaxhighlight>
  
 
'''compress''' takes a pattern and ''squeezes'' it within the specified time span (i.e. the 'arc').
 
'''compress''' takes a pattern and ''squeezes'' it within the specified time span (i.e. the 'arc').
 
The new resulting pattern is a sped up version of the original.
 
The new resulting pattern is a sped up version of the original.
 +
 +
<source>
 +
d1 $ compress (1/4, 3/4) $ s "[bd sn]!"
 +
</source>
 +
 +
In the above example, the pattern will play in an arc spanning from 25% to 75% of the duration of a cycle. It is equivalent to:
 +
 +
<source>
 +
d1 $ s "~ [bd sn]! ~"
 +
</source>
 +
 +
Another example, where all events are different:
 
<source>
 
<source>
 
d1 $ compress (1/4, 3/4) $ n (run 4) # s "arpy"
 
d1 $ compress (1/4, 3/4) $ n (run 4) # s "arpy"
 
</source>
 
</source>
 +
  
 
It differs from [[zoom]] in that it preserves the original pattern but it speeds up its events so to match with the new time period.
 
It differs from [[zoom]] in that it preserves the original pattern but it speeds up its events so to match with the new time period.

Latest revision as of 16:56, 30 May 2020

Type: compress :: (Time, Time) -> Pattern a -> Pattern a

compress takes a pattern and squeezes it within the specified time span (i.e. the 'arc'). The new resulting pattern is a sped up version of the original.

d1 $ compress (1/4, 3/4) $ s "[bd sn]!"

In the above example, the pattern will play in an arc spanning from 25% to 75% of the duration of a cycle. It is equivalent to:

d1 $ s "~ [bd sn]! ~"

Another example, where all events are different:

d1 $ compress (1/4, 3/4) $ n (run 4) # s "arpy"


It differs from zoom in that it preserves the original pattern but it speeds up its events so to match with the new time period.