diff --git a/src/API.ts b/src/API.ts index 7690c02..ae3cdf8 100644 --- a/src/API.ts +++ b/src/API.ts @@ -578,9 +578,10 @@ export class UserAPI { */ return this.randomGen() * (max - min) + min; }; - irand = this.randI + irand = this.randI; rI = this.randI; r = this.rand; + ir = this.randI; seed = (seed: string | number): void => { /** diff --git a/src/Documentation.ts b/src/Documentation.ts index e0b10f9..60c1072 100644 --- a/src/Documentation.ts +++ b/src/Documentation.ts @@ -200,7 +200,7 @@ You can use Topos to play MIDI thanks to the [WebMIDI API](https://developer.moz sometimes() && mod(.25) && note(seqbeat(64, 67, 69) + 24).duration(0.05).out() \`\`\` -### Note chaining +## Note chaining The note(number) function can be chained to _specify_ a midi note more. For instance, you can add a duration, a velocity, a channel, etc...: @@ -431,6 +431,11 @@ You can get the current position of the mouse on the screen by using the followi - mouseX(): the horizontal position of the mouse on the screen (as a floating point number). - mouseY(): the vertical position of the mouse on the screen (as a floating point number). +Current mouse position can also be used to generate notes: + +- noteX(): returns a MIDI note number (0-127) based on the horizontal position of the mouse on the screen. +- noteY(): returns a MIDI note number (0-127) based on the vertical position of the mouse on the screen. + ## Low Frequency Oscillators Low Frequency Oscillators (_LFOs_) are an important piece in any digital audio workstation or synthesizer. Topos implements some basic waveforms you can play with to automatically modulate your paremeters. @@ -473,8 +478,11 @@ Low Frequency Oscillators (_LFOs_) are an important piece in any digital audio w There are some simple functions to play with probabilities. +- rand(min: number, max:number): returns a random number between min and max. Shorthand _r()_. +- irand(min: number, max:number): returns a random integer between min and max. Shorthands _ir()_ or _rI()_. - prob(p: number): return true _p_% of time, false in other cases. - toss(): throwing a coin. Head (true) or tails (false). +- seed(val: number|string): sets the seed of the random number generator. You can use a number or a string. The same seed will always return the same sequence of random numbers. ## Math functions