add sin sqr cos aliases
This commit is contained in:
parent
c691916cbf
commit
05ae31838e
1 changed files with 6 additions and 1 deletions
|
|
@ -71,25 +71,28 @@ export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sine signal between 0 and 1.
|
* A sine signal between 0 and 1.
|
||||||
*
|
|
||||||
* @return {Pattern}
|
* @return {Pattern}
|
||||||
|
* @synonyms sin
|
||||||
* @example
|
* @example
|
||||||
* n(sine.segment(16).range(0,15))
|
* n(sine.segment(16).range(0,15))
|
||||||
* .scale("C:minor")
|
* .scale("C:minor")
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const sine = sine2.fromBipolar();
|
export const sine = sine2.fromBipolar();
|
||||||
|
export const sin = sine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cosine signal between 0 and 1.
|
* A cosine signal between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Pattern}
|
* @return {Pattern}
|
||||||
|
* @synonyms cos
|
||||||
* @example
|
* @example
|
||||||
* n(stack(sine,cosine).segment(16).range(0,15))
|
* n(stack(sine,cosine).segment(16).range(0,15))
|
||||||
* .scale("C:minor")
|
* .scale("C:minor")
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const cosine = sine._early(Fraction(1).div(4));
|
export const cosine = sine._early(Fraction(1).div(4));
|
||||||
|
export const cos = cosine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cosine signal between -1 and 1 (like `cosine`, but bipolar).
|
* A cosine signal between -1 and 1 (like `cosine`, but bipolar).
|
||||||
|
|
@ -102,11 +105,13 @@ export const cosine2 = sine2._early(Fraction(1).div(4));
|
||||||
* A square signal between 0 and 1.
|
* A square signal between 0 and 1.
|
||||||
*
|
*
|
||||||
* @return {Pattern}
|
* @return {Pattern}
|
||||||
|
* @synonyms sqr
|
||||||
* @example
|
* @example
|
||||||
* n(square.segment(4).range(0,7)).scale("C:minor")
|
* n(square.segment(4).range(0,7)).scale("C:minor")
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const square = signal((t) => Math.floor((t * 2) % 2));
|
export const square = signal((t) => Math.floor((t * 2) % 2));
|
||||||
|
export const sqr = square;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A square signal between -1 and 1 (like `square`, but bipolar).
|
* A square signal between -1 and 1 (like `square`, but bipolar).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue