Difference between revisions of "within/zh-tw"

From TidalCycles userbase
Jump to: navigation, search
(Created page with "within")
 
(Created page with "使用'''within'''將函數應用到圖式中的一部分。'''within'''接受兩個參數:起始和終止點(時序),兩者類型都是0和1之間的浮點數,...")
Line 2: Line 2:
 
{{Type|<source inline>within :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a</source>}}
 
{{Type|<source inline>within :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a</source>}}
  
Use '''within''' to apply a function to only a part of a pattern. '''within''' takes two arguments: a start time and an end time, specified as floats between 0 and 1, which are applied to the relevant pattern. Note that the second argument must be greater than the first for the function to have any effect.
+
使用'''within'''將函數應用到圖式中的一部分。'''within'''接受兩個參數:起始和終止點(時序),兩者類型都是0和1之間的浮點數,且作用於相關的圖式。注意第二個參數(終止點)必須大於第一個(起始點)函數才能產生作用。
  
 
For example, to apply <source inline>fast 2</source> to only the first half of a pattern:
 
For example, to apply <source inline>fast 2</source> to only the first half of a pattern:

Revision as of 01:55, 19 November 2019

Type: within :: Arc -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a

使用within將函數應用到圖式中的一部分。within接受兩個參數:起始和終止點(時序),兩者類型都是0和1之間的浮點數,且作用於相關的圖式。注意第二個參數(終止點)必須大於第一個(起始點)函數才能產生作用。

For example, to apply fast 2 to only the first half of a pattern:

d1 $ within (0, 0.5) (fast 2) $ sound "bd*2 sn lt mt hh hh hh hh"

Or, to apply (# speed "0.5") to only the last quarter of a pattern:

d1 $ within (0.75, 1) (# speed "0.5") $ sound "bd*2 sn lt mt hh hh hh hh"