How to use the tone.PolySynth 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 vibertthio / runn / src / music / sound.js View on Github external
this.loadingStatus += 1;
        console.log(`finish...${this.loadingStatus}/9: ${drumUrls[i]}`);
        if (this.loadingStatus === 9) {
          this.loading = false;
        }
      }).toMaster();
      this.samples[i].volume.value = mixing[i];
    }

    this.comp = new Tone.PolySynth(6, Tone.Synth, {
      "oscillator": {
        "partials": [0, 2, 3, 4],
      }
    }).toMaster();

    this.synth = new Tone.PolySynth(3, Tone.Synth, {
      "oscillator": {
        // "type": "fatsawtooth",
        "type": "triangle8",
        // "type": "square",
        "count": 1,
        "spread": 30,
      },
      "envelope": {
        "attack": 0.01,
        "decay": 0.1,
        "sustain": 0.5,
        "release": 0.4,
        "attackCurve": "exponential"
      },
    }).toMaster();
github vibertthio / runn / src / music / sound.js View on Github external
initSounds() {

    for (let i = 0; i < 9; i += 1) {
      this.loadingStatus = 0;
      this.samples[i] = new Player(drumUrls[i], () => {
        this.loadingStatus += 1;
        console.log(`finish...${this.loadingStatus}/9: ${drumUrls[i]}`);
        if (this.loadingStatus === 9) {
          this.loading = false;
        }
      }).toMaster();
      this.samples[i].volume.value = mixing[i];
    }

    this.comp = new Tone.PolySynth(6, Tone.Synth, {
      "oscillator": {
        "partials": [0, 2, 3, 4],
      }
    }).toMaster();

    this.synth = new Tone.PolySynth(3, Tone.Synth, {
      "oscillator": {
        // "type": "fatsawtooth",
        "type": "triangle8",
        // "type": "square",
        "count": 1,
        "spread": 30,
      },
      "envelope": {
        "attack": 0.01,
        "decay": 0.1,
github SonyCSLParis / NONOTO / src / renderer / instruments.ts View on Github external
Tone.Instrument.prototype.pedalUp = function() {return this};


let silentInstrument = new Tone.Instrument()

let piano = new Piano([21, 108], 1);
piano.setVolume('release', -25);
piano.setVolume('pedal', -15);


// let chorus = new Tone.Chorus(2, 1.5, 0.5).toMaster();
// let reverb = new Tone.Reverb(1.5).connect(chorus);
// reverb.generate();
let reverb = new Tone.Volume(0).toMaster();

let polysynth = new Tone.PolySynth(4);
// polysynth.stealVoices = false;
polysynth.connect(reverb);

let polysynth_chords = new Tone.PolySynth(24);
polysynth_chords.connect(reverb);

let steelpan = new Tone.PolySynth(12).set({
    "oscillator": {
        "type": "fatcustom",
        "partials" : [0.2, 1, 0, 0.5, 0.1],
        "spread" : 40,
        "count" : 3},
    "envelope": {
        "attack": 0.001,
        "decay": 1.6,
        "sustain": 0,
github youphonic / youphonic / src / tone / tonePatchOne.js View on Github external
bandSplitter.mid.connect(reverb);
bandSplitter.high.connect(feedbackDel);

const basicSynth = {
	oscillator: {
		type: 'triangle'
	},
	envelope: {
		attack: 0.016,
		decay: 0.1,
		sustain: 0.09,
		release: 0.4
	}
};

export const synthOne = new Tone.PolySynth(4, Tone.Synth, basicSynth).connect(bandSplitter);

export const synthTwo = new Tone.Synth({
	oscillator: {
		type: 'square'
	},
	envelope: {
		attack: 0.016,
		decay: 0.1,
		sustain: 0.09,
		release: 0.04
	},
  volume: -18
}).connect(bandSplitter);


export const triSynth = new Tone.Synth({
github wonderunit / storyboarder / src / js / wonderunit-sound.js View on Github external
if (!getEnableUISoundEffects()) return

  synth = new Tone.PolySynth(getEnableHighQualityAudio() ? 8 : 4, Tone.Synth)
  synth.set({
    "oscillator" : {
      "type" : "square2"
  },
  "envelope" : {
      "attack":0.01,
      "decay":0.01,
      "sustain":1,
      "release":3.5,
  },
  })

  bassSynth = new Tone.PolySynth(3, Tone.FMSynth)
  bassSynth.set({
    "harmonicity":3,
    "modulationIndex":20,
    "detune":0,
    "oscillator":{
    "type":"square",
    },
    "envelope":{
    "attack":0.01,
    "decay":0.01,
    "sustain":1,
    "release":.1,
    },
    "moduation":{
    "type":"sawtooth",
    },
github stc / HackPact / Day-22-Hexagon-Tiling / src / index.js View on Github external
constructor(note, x, y, s) {
        this.note = note;
        this.x = x;
        this.y = y;
        this.s = s;
        this.canplay = true;
        this.fillColor = 0;

        this.fm = new Tone.PolySynth(8, Tone.Synth, {
        "oscillator": {
            "partials": [100, 20, 30, 4],
        },
        "envelope": {
            attack: 0.3,
            decay: 0.6,
            sustain: 4,
            release: 6
        },
      }).chain(chorus, phaser);
        this.fm.volume.value = -4;
      }
github comorebi-notes / rechord / app / frontend / utils / sound.js View on Github external
const setSynth = (score) => {
  const triggerSynth = (time, value) => {
    const { notes, duration } = value
    synth.triggerAttackRelease(notes, duration, time)
  }
  const setSchedule = () => new Tone.Part(triggerSynth, score).start()

  synth = new Tone.PolySynth({ polyphony: 6, voice: Tone.Synth }).toMaster()
  synth.set(soundOptions.synths[0])
  setSchedule(score)
}
github stc / HackPact / Day-13-Latent-Space / src / index.js View on Github external
"baseFrequency": 400
    }).toMaster();
    var NUM_NOTES = 88;
    var MIDI_START_NOTE = 21;
    var synth1 = new Tone.PolySynth(6, Tone.Synth, {
        "oscillator": {
            "partials": [100, 2, 30, 4],
        },
        "envelope": {
            attack: 0.01,
            decay: 0.1,
            sustain: 0.1,
            release: 2
        },
    }).connect(chorus);
    var synth2 = new Tone.PolySynth(6, Tone.Synth, {
        "oscillator": {
            "partials": [1, 2, 3, 4],
        },
        "envelope": {
            attack: 2,
            decay: 3,
            sustain: 2,
            release: 6
        }
    }).connect(phaser);
    var synthDrum = new Tone.MembraneSynth().toMaster();
    var synthHigh = new Tone.MetalSynth({
        "envelope": {
            attack: 0.001,
            decay: 0.1,
            release: 0.1
github dawg / vusic / src / Instru.ts View on Github external
import { Instrument } from '@/models';
import Tone from 'tone';

export default class Instr implements Instrument {
  private o: Instrument;
  private panner = new Tone.Panner().toMaster();
  private synth = new Tone.PolySynth(8, Tone.Synth).connect(this.panner);

  constructor(o: Instrument) {
    this.o = o;
    this.synth.set({ envelope: { attack: 0.005, decay: 0.1, sustain: 0.3, release: 1 } });
    this.type = 'fatsawtooth';
  }
  get name() {
    return this.o.name;
  }
  set name(name: string) {
    this.o.name = name;
  }
  get pan() {
    return this.o.pan;
  }
  set pan(pan: number) {