Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Bubobubobubobubo/Topos
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Dec 20, 2023
2 parents 24dabca + 78c0a67 commit 30caa07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ export class UserAPI {
};

public flipbar = (chunk: number = 1): boolean => {
let realFlip = chunk * 2;
let realFlip = chunk;
const time_pos = this.app.clock.time_position.bar;
const current_chunk = Math.floor(time_pos / realFlip);
return current_chunk % 2 === 0;
Expand Down
21 changes: 20 additions & 1 deletion src/documentation/patterns/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,26 @@ beat(1)::sound(['kick', 'fsnare'].dur(3, 1))
true,
)}
## Iterating over lists
${makeExample(
"Patterning with ternary statements",
`
const dada = flipbar(2) ? [0,[3,5,-1].bar(3),2,3] : [9,8,9,6]
beat(0.5) :: sound('wt_hvoice:3')
.pitch(dada.beat(0.5))
.scale("88.0")
.adsr(0.05, 0.05, 0, 0)
.cutoff(500 + usine(1/8) * 5000)
.room(1.5)
.resonance(0.25)
.out()
beat(1) :: sound('kick').n(4).out()
onbeat([0.5,0.8].beat(1),2) :: sound('snare').out()
onbeat(0.5,0.8,1,1.5,2,2.5,3,4) :: sound('hh').out()
`,
true,
)}
## Iteration using a counter
- <ic>counter(name,limit?,step?)</ic>: return the next value on the list based on counter value. The limit is optional and defaults to the length of the list. The step is optional and defaults to 1. Setting / changing limit will reset the counter.
- <ic>$(name,limit?,step?)</ic>: shorter alias for the counter.
Expand Down

0 comments on commit 30caa07

Please sign in to comment.