try renaming to per / perx / cyclesPer
This commit is contained in:
parent
c7789a09e3
commit
8eeebf1e4f
3 changed files with 151 additions and 148 deletions
|
|
@ -884,45 +884,48 @@ export const keyDown = register('keyDown', function (pat) {
|
|||
});
|
||||
|
||||
/**
|
||||
* A pattern giving the 'looseness' of events, or in other words, the duration of pattern events,
|
||||
* in cycles per event. `loose` doesn't have structure itself, but takes structure, and therefore
|
||||
* A pattern measuring the duration of events,
|
||||
* in cycles per event. `cyclesPer` doesn't have structure itself, but takes structure, and therefore
|
||||
* event durations, from the pattern that it is combined with.
|
||||
* For example `loose.struct("1 1 [1 1] 1")` would give the same as `"0.25 0.25 [0.125 0.125] 0.25"`.
|
||||
* See also its inverse, `tight`.
|
||||
* For example `cyclesPer.struct("1 1 [1 1] 1")` would give the same as `"0.25 0.25 [0.125 0.125] 0.25"`.
|
||||
* See also its reciprocal, `per`, also known as `perCycle`.
|
||||
* @example
|
||||
* // Shorter events are lower in pitch
|
||||
* sound("saw saw [saw saw] saw")
|
||||
* .note(loose.range(50, 100))
|
||||
* .note(cyclesPer.range(50, 100))
|
||||
* @example
|
||||
* sound("bd sd [bd bd] sd*4 [- sd] [bd [bd bd]]")
|
||||
* .note(tight.add(20))
|
||||
* .note(cyclesPer.add(20))
|
||||
*/
|
||||
export const loose = new Pattern(function (state) {
|
||||
export const cyclesPer = new Pattern(function (state) {
|
||||
return [new Hap(undefined, state.span, state.span.duration)];
|
||||
});
|
||||
|
||||
/**
|
||||
* A pattern giving the 'tightness' of events, or in other words, the duration of pattern events,
|
||||
* in events per cycle. `tight` doesn't have structure itself, but takes structure, and therefore
|
||||
* A pattern measuring the 'shortness' of events, or in other words, the duration of pattern events,
|
||||
* in events per cycle. `per` doesn't have structure itself, but takes structure, and therefore
|
||||
* event durations, from the pattern that it is combined with.
|
||||
* For example `tight.struct("1 1 [1 1] 1")` would give the same as `"4 4 [8 8] 4"`.
|
||||
* See also its inverse, `loose`.
|
||||
* For example `per.struct("1 1 [1 1] 1")` would give the same as `"4 4 [8 8] 4"`.
|
||||
* See also its reciprocal, `cyclesPer`.
|
||||
* @synonyms perCycle
|
||||
* @example
|
||||
* // Shorter events are more distorted
|
||||
* n("0 0*2 0 0*2 0 [0 0 0]@2").sound("bd")
|
||||
* .distort(tight.div(2))
|
||||
* .distort(per.div(2))
|
||||
*/
|
||||
export const tight = new Pattern(function (state) {
|
||||
export const per = new Pattern(function (state) {
|
||||
return [new Hap(undefined, state.span, Fraction(1).div(state.span.duration))];
|
||||
});
|
||||
|
||||
export const perCycle = per;
|
||||
|
||||
/**
|
||||
* Like `tight` but gives the tightness of events according to an exponential curve. In
|
||||
* particular, where the event tightness doubles (i.e. where an event duration halves), the
|
||||
* returned value increases by one. `tightx.struct("1 1 1 [1 [1 1]]")` would therefore be
|
||||
* the same as `"3 3 3 [4 [5 5]]"`.
|
||||
* Like `per` but measures the shortness of events according to an exponential curve. In
|
||||
* particular, where the event duration halves, the
|
||||
* returned value increases by one. `perx.struct("1 1 [1 [1 1]] 1")` would therefore be
|
||||
* the same as `"3 3 [4 [5 5]] 3"`.
|
||||
*/
|
||||
export const tightx = new Pattern(function (state) {
|
||||
export const perx = new Pattern(function (state) {
|
||||
const n = Fraction(1).div(state.span.duration);
|
||||
return [new Hap(undefined, state.span, Math.log(n) / Math.log(2) + 1)];
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue