How to use the tonal.Note.oct function in tonal

To help you get started, we’ve selected a few tonal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github generative-music / generative.fm / src / pieces / observable-streams.js View on Github external
note =>
        NOTES.includes(note) && Math.random() < p
          ? from([note, `${Note.pc(note)}${Note.oct(note) + octaveChange}`])
          : of(note)
    )
github generative-music / pieces-alex-bainter / packages / piece-observable-streams / src / piece.js View on Github external
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 () => {
github generative-music / pieces-alex-bainter / packages / piece-moment / src / piece.js View on Github external
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}`);
          };
github generative-music / pieces-alex-bainter / packages / piece-substrate / src / piece.js View on Github external
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();
github generative-music / generative.fm / src / pieces / observable-streams.js View on Github external
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 () => {
github generative-music / pieces-alex-bainter / packages / piece-observable-streams / src / piece.js View on Github external
mergeMap(note =>
      NOTES.includes(note) && Math.random() < p
        ? from([note, `${Note.pc(note)}${Note.oct(note) + octaveChange}`])
        : of(note)
    )
github generative-music / pieces-alex-bainter / packages / piece-a-viable-system / src / piece.js View on Github external
return cMajorRange([lowestNote, highestNote]).filter(note =>
    octaves.includes(Note.oct(note))
  );