How to use the tone.Volume 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 hundredrabbits / Pilot / desktop / sources / scripts / mixer.js View on Github external
this.effects.autowah = new EffectInterface(pilot, 'wah', new Tone.AutoWah(100, 6, 0))
    this.effects.chebyshev = new EffectInterface(pilot, 'che', new Tone.Chebyshev(50))
    // II
    this.effects.feedback = new EffectInterface(pilot, 'fee', new Tone.FeedbackDelay(0))
    this.effects.delay = new EffectInterface(pilot, 'del', new Tone.PingPongDelay('4n', 0.2))
    this.effects.tremolo = new EffectInterface(pilot, 'tre', new Tone.Tremolo())
    this.effects.reverb = new EffectInterface(pilot, 'rev', new Tone.JCReverb(0))
    // III
    this.effects.phaser = new EffectInterface(pilot, 'pha', new Tone.Phaser(0.5, 3, 350))
    this.effects.vibrato = new EffectInterface(pilot, 'vib', new Tone.Vibrato())
    this.effects.chorus = new EffectInterface(pilot, 'cho', new Tone.Chorus(4, 2.5, 0.5))
    this.effects.widener = new EffectInterface(pilot, 'ste', new Tone.StereoWidener(0.5, 3, 350))
    // Mastering
    this.effects.equalizer = new EffectInterface(pilot, 'equ', new Tone.EQ3(5, 0, 5))
    this.effects.compressor = new EffectInterface(pilot, 'com', new Tone.Compressor(-6, 4))
    this.effects.volume = new EffectInterface(pilot, 'vol', new Tone.Volume(6))
    this.effects.limiter = new EffectInterface(pilot, 'lim', new Tone.Limiter(-2))

    // Connect
    for (const id in this.channels) {
      this.channels[id].connect(this.effects.bitcrusher.node)
    }

    this.effects.bitcrusher.connect(this.effects.distortion.node)
    this.effects.distortion.connect(this.effects.autowah.node)
    this.effects.autowah.connect(this.effects.chebyshev.node)
    this.effects.chebyshev.connect(this.effects.feedback.node)

    this.effects.feedback.connect(this.effects.delay.node)
    this.effects.delay.connect(this.effects.tremolo.node)
    this.effects.tremolo.connect(this.effects.reverb.node)
    this.effects.reverb.connect(this.effects.phaser.node)
github wonderunit / storyboarder / src / js / window / sonifier / melodic-instrument.js View on Github external
"type" : "sine"
      },
      "envelope" : {
        "attack": 4,
        "decay": 2,
        "sustain": 0.1,
        "release": 2,
      },
    })

  const synthFilter = new Tone.Filter(1250, "lowpass", -12)
    .set('Q', 0)

  var synthVol = new Tone.Volume(-6)

  var bassSynth2Vol = new Tone.Volume(enableHighQualityAudio ? -6 : -16) // reduce volume when reverb is not available

  let verb
  if (enableHighQualityAudio) {
    verb = new Tone.Freeverb(0.96, 1000).set('wet', 0.1)
    synth.chain(synthFilter, synthVol, verb, Tone.Master)
    bassSynth2.chain(bassSynth2Vol, verb, Tone.Master)
  } else {
    synth.chain(synthFilter, synthVol, Tone.Master)
    bassSynth2.chain(bassSynth2Vol, Tone.Master)
  }

  let lastChangeAt = null
  let shouldTrigger = false
  let firstNote = false

  const start = () => {
github wonderunit / storyboarder / src / js / wonderunit-sound.js View on Github external
'volume': -28
      })
      .toMaster()

  // set up effects and chain them.
  // var freeverb = new Tone.Freeverb(0.9, 1000) // unused
  comp = new Tone.Compressor(-10, 5)
  comp2 = new Tone.Compressor(-10, 5)
  filter = new Tone.Filter(100, "lowpass", -48)
  filter.set('Q', 2)
  filter2 = new Tone.Filter(1250, "lowpass", -12)
  filter2.set('Q', 2)
  filter3 = new Tone.Filter(10, "lowpass", -48)
  filter3.set('Q', 2)
  vol = new Tone.Volume(-24);
  vol2 = new Tone.Volume(-46);

  synth.chain(comp, filter2, vol, Tone.Master)
  bassSynth.chain( filter, comp2, Tone.Master)
  bassSynth2.chain( filter3,vol2, Tone.Master)

  multiPlayer = new Tone.Players(filePathsForSoundEffects)
                .set('volume', -20)
                .toMaster()
}
// route for sound effects by name/purpose
github wonderunit / storyboarder / src / js / window / sonifier / melodic-instrument.js View on Github external
.set({
      "oscillator" : {
        "type" : "sine"
      },
      "envelope" : {
        "attack": 4,
        "decay": 2,
        "sustain": 0.1,
        "release": 2,
      },
    })

  const synthFilter = new Tone.Filter(1250, "lowpass", -12)
    .set('Q', 0)

  var synthVol = new Tone.Volume(-6)

  var bassSynth2Vol = new Tone.Volume(enableHighQualityAudio ? -6 : -16) // reduce volume when reverb is not available

  let verb
  if (enableHighQualityAudio) {
    verb = new Tone.Freeverb(0.96, 1000).set('wet', 0.1)
    synth.chain(synthFilter, synthVol, verb, Tone.Master)
    bassSynth2.chain(bassSynth2Vol, verb, Tone.Master)
  } else {
    synth.chain(synthFilter, synthVol, Tone.Master)
    bassSynth2.chain(bassSynth2Vol, Tone.Master)
  }

  let lastChangeAt = null
  let shouldTrigger = false
  let firstNote = false
github tambien / Piano / src / Piano.js View on Github external
*/
		this._pedalOutput = new Volume(options.volume.pedal).connect(this.output)
		this.pedal = this._pedalOutput.volume
		this._pedalSampler = new Pedal(options).connect(this._pedalOutput)

		/**
		 * The keybed release sound
		 */
		this._keybedOutput = new Volume(options.volume.keybed).connect(this.output)
		this.keybed = this._keybedOutput.volume
		this._keybedSampler = new Keybed(options).connect(this._keybedOutput)

		/**
		 * The string harmonics
		 */
		this._harmonicsOutput = new Volume(options.volume.harmonics).connect(this.output)
		this.harmonics = this._harmonicsOutput.volume
		this._harmonicsSampler = new Harmonics(options).connect(this._harmonicsOutput)
	}
github generative-music / generative.fm / src / pieces / meditation.js View on Github external
getSampledInstrument('kasper-singing-bowls').then(bowls => {
    const volume = new Volume(-20).connect(master);
    const delay = new FeedbackDelay({
      wet: 0.5,
      delayTime: delayTimeInSeconds,
      feedback: delayFeedback,
    });
    bowls.chain(delay, volume, master);
    const instruments = [makeInstrument({ toneInstrument: bowls })];
    piece({ instruments, time });
    return () => {
      [bowls, delay, volume].forEach(node => node.dispose());
    };
  });
github generative-music / generative.fm / src / components / player / index.jsx View on Github external
constructor(props) {
    super(props);
    const savedVolume = Number.parseFloat(
      localStorage.getItem(SAVED_VOLUME_KEY)
    );
    const startingVolume = Number.isNaN(savedVolume)
      ? DEFAULT_VOLUME_PCT
      : savedVolume;
    this.state = {
      isPlaying: false,
      volume: startingVolume,
      sliderVolume: startingVolume,
      isMuted: false,
      isReady: false,
      masterVolumeNode: new Tone.Volume(
        convertPctToDb(startingVolume)
      ).toMaster(),
    };
    this.handleVolumeChange = this.handleVolumeChange.bind(this);
    this.handleClick = this.handleClick.bind(this);
    this.handlePlayClick = this.handlePlayClick.bind(this);
    this.handleMuteClick = this.handleMuteClick.bind(this);
    this.handleUnmuteClick = this.handleUnmuteClick.bind(this);
  }
  render() {
github abagames / rj-10 / src / sound.ts View on Github external
import Tone from "tone";
import MMLIterator from "mml-iterator";
import { range } from "./util/math";

export const synths = [
  new Tone.Synth(getSynthParams("pulse")).chain(
    new Tone.Volume(-32),
    Tone.Master
  ),
  new Tone.Synth(getSynthParams("square")).chain(
    new Tone.Volume(-32),
    Tone.Master
  ),
  new Tone.Synth(getSynthParams("triangle")).chain(
    new Tone.Volume(-16),
    Tone.Master
  ),
  new Tone.NoiseSynth().chain(new Tone.Volume(-16), Tone.Master)
];
const mmls: string[] = range(4).map(() => undefined);
const parts: Tone.Part[] = range(4).map(() => undefined);
const tempo = 200;
const defaultOctave = 4;
const defaultLength = 32;

Tone.Transport.start();
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);
github generative-music / generative.fm / src / pieces / otherness.js View on Github external
getSampledInstrument('otherness').then(instrument => {
    const volume = new Tone.Volume(-5).connect(master);
    const sineSynth = new Tone.MonoSynth({
      oscillator: { type: 'sine' },
      envelope: {
        attack: 3,
        release: 10,
      },
    }).connect(volume);

    instrument.connect(volume);

    sineSynth.volume.value = -25;
    instrument.volume.value = -5;

    let lastTimeout;
    const onTimeoutCreated = timeout => {
      lastTimeout = timeout;