Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
note =>
NOTES.includes(note) && Math.random() < p
? from([note, `${Note.pc(note)}${Note.oct(note) + octaveChange}`])
: of(note)
)
const noteSubscription = notes$.subscribe(note => {
if (
Math.random() < 0.1 &&
Note.oct(note) > 3 &&
Tone.now() - lastViolinTimeS > 20
) {
lastViolinTimeS = Tone.now();
violin.triggerAttack(note, '+1');
} else {
piano.triggerAttack(note, '+1');
}
});
return () => {
Tone.Transport.scheduleOnce(() => {
const octave = Note.oct(note);
if (
(octave === 3 || (octave === 2 && pc === 'G')) &&
Math.random() < 0.1
) {
playHums(note);
} else if (Math.random() < 0.1) {
playHums('E3');
}
playGuitar(note);
play();
}, `+${time}`);
};
note => Note.oct(note) < 5 || Note.pc(note) === 'C'
);
const playAndScheduleNext = () => {
const next = noteGenerator.next();
if (!next.done) {
playNote(next.value);
const pc = Note.pc(next.value);
const oct = Note.oct(next.value);
if (Math.random() < 0.5) {
const delay = Math.random() < 0.5 ? 0 : Math.random() * 2;
playSecondaryNote(`${pc}${oct + 1}`, delay);
}
Tone.Transport.scheduleOnce(() => {
playAndScheduleNext();
}, `+${3 + Math.random()}`);
} else {
noteGenerator = makeNoteGenerator(swapTwo(notes));
Tone.Transport.scheduleOnce(() => {
playAndScheduleNext();
}, `+${Math.random() + 4}`);
}
};
playAndScheduleNext();
const noteSubscription = notes$.subscribe(note => {
if (
Math.random() < 0.1 &&
Note.oct(note) > 3 &&
Date.now() - lastViolinTime > 20000
) {
lastViolinTime = Date.now();
violin.triggerAttack(note, '+1');
} else {
piano.triggerAttack(note, '+1');
}
});
return () => {
mergeMap(note =>
NOTES.includes(note) && Math.random() < p
? from([note, `${Note.pc(note)}${Note.oct(note) + octaveChange}`])
: of(note)
)
return cMajorRange([lowestNote, highestNote]).filter(note =>
octaves.includes(Note.oct(note))
);