Skip to content

Commit

Permalink
first wip of seq func
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Oct 24, 2023
1 parent 9ffdca6 commit e424fb5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,25 @@ export class UserAPI {
// Time Filters
// =============================================================


public seq = (expr: string, duration: number): boolean => {
let len = expr.length * duration
let output: number[] = [];

for (let i = 1; i <= len + 1; i += duration) {
output.push(Math.floor(i * 10) / 10);
}
output.pop()

output = output.filter((_, idx) => {
const exprIdx = idx % expr.length;
return expr[exprIdx] === 'x';
});

return this.oncount(output, len)
}


public beat = (n: number | number[] = 1, nudge: number = 0): boolean => {
/**
* Determine if the current pulse is on a specified beat, with optional nudge.
Expand Down

0 comments on commit e424fb5

Please sign in to comment.