How to use the tone.Frequency function in tone

To help you get started, we’ve selected a few tone 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 tambien / Piano / src / Util.js View on Github external
function noteToMidi(note){
	return Frequency(note).toMidi()
}
github vibertthio / runn / src / music / sound.js View on Github external
let notes = m[this.melodiesIndex].notes.map(note => {
      const s = note.quantizedStartStep;
      return {
        'time': `${Math.floor(s / 16)}:${Math.floor(s / 4) % 4}:${(s % 4)}`,
        'note': Tone.Frequency(note.pitch, 'midi'),
        'isDrum': false,
        'chord': false,
      };
    });
github wonderunit / storyboarder / src / js / window / sonifier / melodic-instrument.js View on Github external
undefined,
        1
      )
      firstNote = false
    }

    if (enableHighQualityAudio) {
      if (velocity > 0.25) {
        synth.triggerAttackRelease(
          Tone.Frequency(seq.recent()).transpose(Math.random() > 0.5 ? +12 : 0),
          "32n",
          undefined,
          velocity)
        
        synth.triggerAttackRelease(
          Tone.Frequency(seq.recent()).transpose(velocity > 0.4 ? +12 : 0),
          "16n",
          undefined,
          velocity * 0.5
        )
      }
    }

    shouldTrigger = false
  }
github ritz078 / raaga / utils / MidiPlayer / MidiPlayer.ts View on Github external
time => {
        this.drumSampler.triggerAttack(
          Tone.Frequency(beatInstrumentNumber, "midi").toNote(),
          time
        );
      },
      beat.notes.map(_beat => ({
github tensorflow / magenta-js / music / src / core / player.ts View on Github external
private playNote(time: number, note: NoteSequence.INote) {
    if (note.isDrum) {
      this.drumKit.playNote(note.pitch, time);
    } else {
      const freq = new Tone.Frequency(note.pitch, 'midi');
      const dur = note.endTime - note.startTime;
      this.getSynth(note.instrument, note.program)
          .triggerAttackRelease(freq, dur, time);
    }
  }
github tambien / Piano / src / Util.ts View on Github external
export function noteToMidi(note: string): number {
	return Frequency(note).toMidi()
}
github wonderunit / storyboarder / src / js / wonderunit-sound.js View on Github external
let rollover = () => {
  if (!getEnableUISoundEffects()) return

  let note = chords[currentChord][currentNote % (chords[0].length)]
  let bassnote = chords[currentChord][0]
  let onote = chords2[currentChord][currentNote % (chords[0].length)]
  synth.triggerAttackRelease(Tone.Frequency(note).transpose(+12), "16n", undefined, 0.03);
  if (currentNote == 0) {
    bassSynth2.triggerAttackRelease(Tone.Frequency(note).transpose(+12*1), "8n", undefined, 0.03);
  }
  synth.triggerAttackRelease(Tone.Frequency(onote).transpose(+24), "16n", undefined, 0.05);
  advanceNote(1)
}
github wonderunit / storyboarder / src / js / wonderunit-sound.js View on Github external
setTimeout(()=>{
    bassSynth.triggerAttackRelease(Tone.Frequency(bassnote).transpose((-12*3)), 0.2, undefined, 0.2);
    synth.triggerAttackRelease(Tone.Frequency(bassnote).transpose((+12*2)), "16n", undefined, 0.4);
  }, 150)
  advanceNote(1)
github wonderunit / storyboarder / src / js / wonderunit-sound.js View on Github external
let bip = (note) => {
  if (!getEnableUISoundEffects()) return

  bipSynth.triggerAttackRelease(Tone.Frequency(note).transpose(-12), "16n", undefined, 0.25)
  advanceNote(1)
}
github tensorflow / magenta-js / music / demos / piano_genie.ts View on Github external
document.onkeydown = (evt: KeyboardEvent) => {
    if (Tone.context.state !== 'running') {
      Tone.context.resume();
    }
    const key = evt.keyCode;
    const button = key - 49;
    if (button >= 0 && button < NUM_BUTTONS) {
      if (heldButtonToMidiNote.has(button)) {
        return;
      }

      const output = genie.next(button, TEMPERATURE);
      const note = output + LOWEST_PIANO_KEY_MIDI_NOTE;

      synth.triggerAttack(Tone.Frequency(note, 'midi'));
      heldButtonToMidiNote.set(button, note);
    }
  };