How to use the tone.Buffers 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 generative-music / pieces-alex-bainter / packages / piece-didgeridoobeats / src / piece.js View on Github external
new Promise(resolve => {
    const buffers = new Tone.Buffers(instrumentSamples, () => resolve(buffers));
  });
github generative-music / pieces-alex-bainter / packages / piece-eyes-closed / src / piece.js View on Github external
new Promise(resolve => {
    const activeSources = [];
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () =>
        resolve({
          triggerAttack: (note, time = '+1') => {
            const closestSample = findClosest(samplesByNote, note);
            const difference = Distance.semitones(closestSample, note);
            const buffer = buffers.get(closestSample);
            const playbackRate = Tone.intervalToFrequencyRatio(
              difference + semitoneChange
            );
            const source = new Tone.BufferSource(buffer)
              .set({
                playbackRate,
                onended: () => {
                  const i = activeSources.indexOf(buffer);
                  if (i >= 0) {
                    activeSources.splice(i, 1);
github generative-music / pieces-alex-bainter / packages / piece-buttafingers / src / piece.js View on Github external
new Promise(resolve => {
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () => resolve(buffers),
    });
  });
github generative-music / pieces-alex-bainter / packages / piece-drones / src / piece.js View on Github external
new Promise(resolve => {
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () => resolve(buffers),
    });
  });
github generative-music / pieces-alex-bainter / packages / piece-substrate / src / piece.js View on Github external
new Promise(resolve => {
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () => resolve(buffers),
      baseUrl,
    });
  });
github generative-music / pieces-alex-bainter / packages / piece-homage / src / piece.js View on Github external
new Promise(resolve => {
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () => resolve(buffers),
    });
  });
github generative-music / pieces-alex-bainter / packages / piece-nakaii / src / piece.js View on Github external
new Promise(resolve => {
    const activeSources = [];
    const buffers = new Tone.Buffers(samplesByNote, {
      onload: () => {
        resolve({
          triggerAttack: (note, time = Tone.now()) => {
            const closestSample = findClosest(note, samplesByNote);
            const difference = Distance.semitones(closestSample, note);
            const buffer = buffers.get(closestSample);
            const playbackRate = Tone.intervalToFrequencyRatio(
              difference - semitoneChange + Math.random() * 0.1 - 0.05
            );
            const bufferSource = new Tone.BufferSource(buffer)
              .set({
                playbackRate,
                onended: () => {
                  const i = activeSources.indexOf(bufferSource);
                  if (i >= 0) {
                    activeSources.splice(i, 1);