fixed
This commit is contained in:
parent
4fa0a9064b
commit
6b5de5fec8
1 changed files with 8 additions and 1 deletions
|
|
@ -160,7 +160,12 @@ export const __chooseWith = (pat, xs) => {
|
|||
if (xs.length == 0) {
|
||||
return silence;
|
||||
}
|
||||
return pat.range(0, xs.length).fmap((i) => xs[Math.floor(i)]);
|
||||
|
||||
return pat.range(0, xs.length).fmap((i) => {
|
||||
const key = Math.min(Math.max(Math.floor(i), 0), xs.length - 1);
|
||||
console.log({ key });
|
||||
return xs[key];
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Choose from the list of values (or patterns of values) using the given
|
||||
|
|
@ -179,6 +184,8 @@ export const chooseWith = (pat, xs) => {
|
|||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* note("c g g d f").s(chooseInWith(slider(1, 0, 1), ["sawtooth", "triangle", "bd hh sd hh"]))
|
||||
*/
|
||||
export const chooseInWith = (pat, xs) => {
|
||||
return __chooseWith(pat, xs).innerJoin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue