document new function
This commit is contained in:
10
src/API.ts
10
src/API.ts
@ -882,12 +882,10 @@ export class UserAPI {
|
|||||||
return current_chunk % 2 === 0;
|
return current_chunk % 2 === 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
onbar = (n: number, ...bar: number[]): boolean => {
|
public onbar = (n: number, ...bar: number[]): boolean => {
|
||||||
// n is acting as a modulo on the bar number
|
return bar.some(b => ((b - 1) % n) < n);
|
||||||
const bar_list = [...Array(n).keys()].map((i) => i + 1);
|
};
|
||||||
console.log(bar.some((b) => bar_list.includes(b % n)));
|
|
||||||
return bar.some((b) => bar_list.includes(b % n));
|
|
||||||
};
|
|
||||||
|
|
||||||
onbeat = (...beat: number[]): boolean => {
|
onbeat = (...beat: number[]): boolean => {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -485,7 +485,17 @@ if (onbar(4, 1, 3)) {
|
|||||||
`,
|
`,
|
||||||
true
|
true
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
- <icode>divbar(bar: number)</icode>: return <icode>true</icode> or <icode>false</icode> alternatively every _n_ bars.
|
||||||
|
${makeExample(
|
||||||
|
"Alternating over four bars",
|
||||||
|
`
|
||||||
|
divbar(2)
|
||||||
|
? mod(.5) && snd(['kick', 'hh'].div(1)).out()
|
||||||
|
: mod(.5) && snd(['east', 'snare'].div(1)).out()
|
||||||
|
`, true)};
|
||||||
|
|
||||||
## What are pulses?
|
## What are pulses?
|
||||||
|
|
||||||
To make a beat, you need a certain number of time grains or **pulses**. The **pulse** is also known as the [PPQN](https://en.wikipedia.org/wiki/Pulses_per_quarter_note). By default, Topos is using a _pulses per quarter note_ of 48. You can change it by using the <icode>ppqn(number)</icode> function. It means that the lowest possible rhythmic value is 1/48 of a quarter note. That's plenty of time already.
|
To make a beat, you need a certain number of time grains or **pulses**. The **pulse** is also known as the [PPQN](https://en.wikipedia.org/wiki/Pulses_per_quarter_note). By default, Topos is using a _pulses per quarter note_ of 48. You can change it by using the <icode>ppqn(number)</icode> function. It means that the lowest possible rhythmic value is 1/48 of a quarter note. That's plenty of time already.
|
||||||
|
|||||||
Reference in New Issue
Block a user