How to use the tone.LFO 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-last-transit / src / piece.js View on Github external
]).then(([buffer, reverb]) => {
        const activeSources = [];
        const vol = new Tone.Volume(10).connect(destination);
        reverb.connect(vol);
        const filter = new Tone.AutoFilter(Math.random() / 30).connect(reverb);
        filter.start();
        const lfo = new Tone.LFO(Math.random() / 100, 0.05, 0.25);
        lfo.start();
        const play = () => {
          const source = new Tone.BufferSource(buffer)
            .set({
              onended: () => {
                const i = activeSources.indexOf(source);
                if (i >= 0) {
                  activeSources.splice(i, 1);
                }
              },
            })
            .connect(filter);
          lfo.connect(source.playbackRate);
          source.start();
          Tone.Transport.scheduleOnce(() => {
            play();
github generative-music / pieces-alex-bainter / packages / piece-drones-2 / src / piece.js View on Github external
source.dispose();
                  disposableNodes.splice(i, 1);
                }
              },
            })
            .connect(droneDestination);
          source.start('+1');
        };
        const autoFilter = new Tone.AutoFilter(Math.random() / 10, 150, 4)
          .connect(filter)
          .start();

        const lfoMin = Math.random() / 100;
        const lfoMax = lfoMin * 10;

        const frequencyLfo = new Tone.LFO({ min: lfoMin, max: lfoMax });

        frequencyLfo.connect(autoFilter.frequency);
        frequencyLfo.start();

        disposableNodes.push(autoFilter, frequencyLfo);

        NOTES.forEach(note => {
          const playDrone = () => {
            drone(note, autoFilter, -36);
            Tone.Transport.scheduleOnce(() => {
              playDrone();
            }, `+${Math.random() * 20 + 40}`);
          };
          playDrone();
        });
github generative-music / generative.fm / src / pieces / timbral-oscillations.js View on Github external
frequency: Math.random() / 100,
      baseFrequency: 250,
      octaves: 5,
      type: 'sine',
    });
    autoFilter.start();

    const pitchLfo = new Tone.LFO({
      frequency: Math.random() / 100,
      phase: 90,
    });
    pitchLfo.start();
    const pitchShift = new Tone.PitchShift({ pitch: 7 });
    pitchLfo.connect(pitchShift.wet);

    const tremoloFrequencyLfo = new Tone.LFO({
      frequency: Math.random() / 100,
      phase: 90,
      min: 0.1,
      max: 10,
    });
    const tremoloLfo = new Tone.LFO({
      frequency: Math.random() / 100,
      phase: 90,
    });
    tremoloFrequencyLfo.start();
    tremoloLfo.start();
    const tremolo = new Tone.Tremolo();
    tremoloFrequencyLfo.connect(tremolo.frequency);
    tremoloLfo.connect(tremolo.wet);
    tremolo.start();
github generative-music / pieces-alex-bainter / packages / piece-timbral-oscillations / src / piece.js View on Github external
const pitchLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
      });
      pitchLfo.start();
      const pitchShift = new Tone.PitchShift({ pitch: 7 });
      pitchLfo.connect(pitchShift.wet);

      const tremoloFrequencyLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
        min: 0.1,
        max: 10,
      });
      const tremoloLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
      });
      tremoloFrequencyLfo.start();
      tremoloLfo.start();
      const tremolo = new Tone.Tremolo();
      tremoloFrequencyLfo.connect(tremolo.frequency);
      tremoloLfo.connect(tremolo.wet);
      tremolo.start();

      const compressor = new Tone.Compressor();

      piano.chain(
        pitchShift,
        delay,
        reverb,
github generative-music / pieces-alex-bainter / packages / piece-drones / src / piece.js View on Github external
source.dispose();
                      disposableNodes.splice(index, 1);
                    }
                  },
                })
                .connect(droneDestination);
              source.start('+1');
            };
            const autoFilter = new Tone.AutoFilter(Math.random() / 10, 150, 4)
              .connect(masterVol)
              .start();

            const lfoMin = Math.random() / 100;
            const lfoMax = lfoMin * 10;

            const frequencyLfo = new Tone.LFO({ min: lfoMin, max: lfoMax });

            frequencyLfo.connect(autoFilter.frequency);
            frequencyLfo.start();

            const lastVol = new Tone.Volume();
            const lastVolLfo = new Tone.LFO({
              min: -100,
              max: -10,
              frequency: Math.random() / 100,
              phase: 90,
            });
            lastVolLfo.connect(lastVol.volume);
            lastVolLfo.start();
            lastVol.connect(autoFilter);

            disposableNodes.push(autoFilter, frequencyLfo, lastVol, lastVolLfo);
github generative-music / generative.fm / src / pieces / timbral-oscillations.js View on Github external
getSampledInstrument('vsco2-piano-mf').then(piano => {
    const reverb = new Tone.Freeverb({ roomSize: 0.7 });

    const delayFudge = Math.random() * 3;
    const delay = new Tone.FeedbackDelay({
      wet: 0.5,
      delayTime: 5 + delayFudge,
      feedback: 0.8 - delayFudge / 100,
    });

    const chorusLfo = new Tone.LFO({
      frequency: Math.random() / 100,
      phase: 90,
    });
    chorusLfo.start();
    const chorus = new Tone.Chorus({ wet: 0 });
    chorusLfo.connect(chorus.wet);

    const autoFilter = new Tone.AutoFilter({
      frequency: Math.random() / 100,
      baseFrequency: 250,
      octaves: 5,
      type: 'sine',
    });
    autoFilter.start();

    const pitchLfo = new Tone.LFO({
github generative-music / generative.fm / src / pieces / apoapsis.js View on Github external
getSamples().then(samples => {
    const noise = new Tone.Noise('brown');
    const eq = new Tone.EQ3(-15, -Infinity, -Infinity).connect(master);
    eq.lowFrequency.value = Note.freq('C1');
    const lfo = new Tone.LFO({
      min: -50,
      max: -15,
      frequency: Math.random() / 100,
      phase: 45,
    });
    lfo.connect(eq.low);
    noise.connect(eq);
    lfo.start();
    noise.start();

    const delay1 = new Tone.FeedbackDelay({
      feedback: 0.7,
      delayTime: 0.2,
      wet: 0.5,
    });
    const delay2 = new Tone.FeedbackDelay({
github generative-music / pieces-alex-bainter / packages / piece-buttafingers / src / piece.js View on Github external
wines.forEach((wine, i) => {
          const vol = new Tone.Volume().connect(filter);
          const lfo = new Tone.LFO({
            min: -500,
            max: 30,
            frequency: Math.random() / 100,
            phase: Math.random() * 360,
          });
          lfo.connect(vol.volume).start();
          wine.connect(vol);
          const playNote = () => {
            wine.triggerAttack(NOTES[i], '+1');
            Tone.Transport.scheduleOnce(() => {
              playNote();
            }, '+60');
          };
          Tone.Transport.scheduleOnce(() => {
            playNote();
          }, `+${startDelays[i] - minStartDelay + 1}`);
github generative-music / pieces-alex-bainter / packages / piece-timbral-oscillations / src / piece.js View on Github external
frequency: Math.random() / 100,
        baseFrequency: 250,
        octaves: 5,
        type: 'sine',
      });
      autoFilter.start();

      const pitchLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
      });
      pitchLfo.start();
      const pitchShift = new Tone.PitchShift({ pitch: 7 });
      pitchLfo.connect(pitchShift.wet);

      const tremoloFrequencyLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
        min: 0.1,
        max: 10,
      });
      const tremoloLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        phase: 90,
      });
      tremoloFrequencyLfo.start();
      tremoloLfo.start();
      const tremolo = new Tone.Tremolo();
      tremoloFrequencyLfo.connect(tremolo.frequency);
      tremoloLfo.connect(tremolo.wet);
      tremolo.start();
github generative-music / pieces-alex-bainter / packages / piece-townsend / src / piece.js View on Github external
.then(([flute, guitarBuffers, fluteReverb]) => {
      const volume = new Tone.Volume(-10);

      const volumeLfo = new Tone.LFO({
        frequency: Math.random() / 100,
        min: -30,
        max: -10,
      });
      volumeLfo.connect(flute.volume);
      volumeLfo.start();
      const delay = new Tone.FeedbackDelay({ delayTime: 1, feedback: 0.7 });
      flute.chain(fluteReverb, delay, volume, destination);

      const intervalTimes = FLUTE_NOTES.map(() => Math.random() * 10 + 5);

      const shortestInterval = Math.min(...intervalTimes);

      FLUTE_NOTES.forEach((note, i) => {
        Tone.Transport.scheduleRepeat(
          () => flute.triggerAttack(note, '+1'),