How to use the tonal.Note.midi 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 / pieces-alex-bainter / packages / piece-drones-2 / src / piece.js View on Github external
const findClosest = (samplesByNote, note) => {
  const noteMidi = Note.midi(note);
  const maxInterval = 96;
  let interval = 0;
  while (interval <= maxInterval) {
    const higherNote = Note.fromMidi(noteMidi + interval);
    if (samplesByNote[higherNote]) {
      return higherNote;
    }
    const lowerNote = Note.fromMidi(noteMidi - interval);
    if (samplesByNote[lowerNote]) {
      return lowerNote;
    }
    interval += 1;
  }
  return note;
};
github generative-music / generative.fm / src / pieces / otherness.js View on Github external
const timeout = setTimeout(() => {
    playNote(instrument, sineSynth, onTimeoutCreated, Note.midi(note));
  }, Math.random() * 10000 + 10000);
  onTimeoutCreated(timeout);
github comorebi-notes / rechord / app / frontend / utils / index.js View on Github external
    return notes.map(note => Note.fromMidi(Note.midi(note) + Number(capo)))
  } else {
github marcel-dancak / bass-app / src / components / NoteSelect.vue View on Github external
items () {
      const items = []
      const startCode = Note.midi(this.root)
      for (let i = 0; i < this.length; i++) {
        const note = Note.props(Note.fromMidi(startCode + i))
        const item = {
          fret: i,
          octave: note.oct,
          name: note.pc
        }
        const enharmonic = Note.enharmonic(item.name)
        if (enharmonic !== item.name) {
          item.flatName = item.name.replace('b', '♭')
          item.name = enharmonic.replace('#', '♯')
        }
        items.push(item)
      }
      return items
    }
github generative-music / pieces-alex-bainter / packages / piece-otherness / src / piece.js View on Github external
Tone.Transport.scheduleOnce(() => {
    playNote(instrument, sineSynth, Note.midi(note));
  }, `+${Math.random() * 10 + 10}`);
};
github comorebi-notes / rechord / app / frontend / utils / scoreMaker.js View on Github external
const keyAdjuster = () => (
    Note.midi(notes[0]) > Note.midi(`${denominator}${baseKey}`) ? 0 : -1
  )
  const newRoot = `${denominator}${baseKey + keyAdjuster()}`
github generative-music / pieces-alex-bainter / packages / piece-moment / src / piece.js View on Github external
const findClosest = (samplesByNote, note) => {
  const noteMidi = Note.midi(note);
  const maxInterval = 96;
  let interval = 0;
  while (interval <= maxInterval) {
    const higherNote = Note.fromMidi(noteMidi + interval);
    if (samplesByNote[higherNote]) {
      return higherNote;
    }
    const lowerNote = Note.fromMidi(noteMidi - interval);
    if (samplesByNote[lowerNote]) {
      return lowerNote;
    }
    interval += 1;
  }
  return note;
};
github generative-music / pieces-alex-bainter / packages / piece-homage / src / piece.js View on Github external
const findClosest = (samplesByNote, note) => {
  const noteMidi = Note.midi(note);
  const maxInterval = 96;
  let interval = 0;
  while (interval <= maxInterval) {
    const higherNote = Note.fromMidi(noteMidi + interval);
    if (samplesByNote[higherNote]) {
      return higherNote;
    }
    const lowerNote = Note.fromMidi(noteMidi - interval);
    if (samplesByNote[lowerNote]) {
      return lowerNote;
    }
    interval += 1;
  }
  return note;
};
github marcel-dancak / bass-app / vue / src / components / Fretboard.vue View on Github external
stringNotes (root) {
      const notes = []
      const startCode = Note.midi(root)
      for (let i = 0; i <= this.frets; i++) {
        const note = Note.props(Note.fromMidi(startCode + i))
        const item = {
          fret: i,
          octave: note.oct,
          name: note.pc
        }
        const enharmonic = Note.enharmonic(item.name)
        if (enharmonic !== item.name) {
          item.flatName = item.name.replace('b', '♭')
          item.name = enharmonic.replace('#', '♯')
        }
        notes.push(item)
      }
      return notes
    },
github generative-music / pieces-alex-bainter / packages / piece-drones / src / piece.js View on Github external
const findClosest = (samplesByNote, note) => {
  const noteMidi = Note.midi(note);
  const maxInterval = 96;
  let interval = 0;
  while (interval <= maxInterval) {
    const higherNote = Note.fromMidi(noteMidi + interval);
    if (samplesByNote[higherNote]) {
      return higherNote;
    }
    const lowerNote = Note.fromMidi(noteMidi - interval);
    if (samplesByNote[lowerNote]) {
      return lowerNote;
    }
    interval += 1;
  }
  return note;
};