mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
instrument jsdoc'ing
This commit is contained in:
parent
8b7b4ab3f3
commit
216ed6e472
13 changed files with 44 additions and 37 deletions
|
@ -11,8 +11,8 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var synth = new Tone.AMSynth();
|
* var synth = new Tone.AMSynth();
|
||||||
*/
|
*/
|
||||||
|
@ -22,28 +22,28 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first voice
|
* The carrier voice.
|
||||||
* @type {Tone.MonoSynth}
|
* @type {Tone.MonoSynth}
|
||||||
*/
|
*/
|
||||||
this.carrier = new Tone.MonoSynth(options.carrier);
|
this.carrier = new Tone.MonoSynth(options.carrier);
|
||||||
this.carrier.volume.value = -10;
|
this.carrier.volume.value = -10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the second voice
|
* The modulator voice.
|
||||||
* @type {Tone.MonoSynth}
|
* @type {Tone.MonoSynth}
|
||||||
*/
|
*/
|
||||||
this.modulator = new Tone.MonoSynth(options.modulator);
|
this.modulator = new Tone.MonoSynth(options.modulator);
|
||||||
this.modulator.volume.value = -10;
|
this.modulator.volume.value = -10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the frequency control
|
* The frequency.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.frequency = new Tone.Signal(440, Tone.Type.Frequency);
|
this.frequency = new Tone.Signal(440, Tone.Type.Frequency);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the ratio between the two voices
|
* The ratio between the two voices.
|
||||||
* @type {Positive}
|
* @type {Positive}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,7 +10,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Instrument}
|
* @extends {Tone.Instrument}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var synth = new Tone.DrumSynth();
|
* var synth = new Tone.DrumSynth();
|
||||||
|
|
|
@ -10,7 +10,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var duoSynth = new Tone.DuoSynth();
|
* var duoSynth = new Tone.DuoSynth();
|
||||||
|
|
|
@ -9,7 +9,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var fmSynth = new Tone.FMSynth();
|
* var fmSynth = new Tone.FMSynth();
|
||||||
|
@ -20,14 +20,14 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first voice
|
* The carrier voice.
|
||||||
* @type {Tone.MonoSynth}
|
* @type {Tone.MonoSynth}
|
||||||
*/
|
*/
|
||||||
this.carrier = new Tone.MonoSynth(options.carrier);
|
this.carrier = new Tone.MonoSynth(options.carrier);
|
||||||
this.carrier.volume.value = -10;
|
this.carrier.volume.value = -10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the second voice
|
* The modulator voice.
|
||||||
* @type {Tone.MonoSynth}
|
* @type {Tone.MonoSynth}
|
||||||
*/
|
*/
|
||||||
this.modulator = new Tone.MonoSynth(options.modulator);
|
this.modulator = new Tone.MonoSynth(options.modulator);
|
||||||
|
|
|
@ -52,12 +52,15 @@ define(["Tone/core/Tone", "Tone/core/Master", "Tone/core/Note"], function(Tone){
|
||||||
Tone.Instrument.prototype.triggerRelease = function(){};
|
Tone.Instrument.prototype.triggerRelease = function(){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trigger the attack and then the release
|
* Trigger the attack and then the release after the duration.
|
||||||
* @param {string|number} note the note to trigger
|
* @param {string|number} note the note to trigger
|
||||||
* @param {Time} duration the duration of the note
|
* @param {Time} duration the duration of the note
|
||||||
* @param {Time} [time=now] the time of the attack
|
* @param {Time} [time=now] the time of the attack
|
||||||
* @param {NormalRange} [velocity=1] the velocity
|
* @param {NormalRange} [velocity=1] the velocity
|
||||||
* @returns {Tone.Instrument} this
|
* @returns {Tone.Instrument} this
|
||||||
|
* @example
|
||||||
|
* //trigger "C4" for the duration of an 8th note
|
||||||
|
* synth.triggerAttackRelease("C4", "8n");
|
||||||
*/
|
*/
|
||||||
Tone.Instrument.prototype.triggerAttackRelease = function(note, duration, time, velocity){
|
Tone.Instrument.prototype.triggerAttackRelease = function(note, duration, time, velocity){
|
||||||
time = this.toSeconds(time);
|
time = this.toSeconds(time);
|
||||||
|
|
|
@ -10,7 +10,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object=} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
*/
|
*/
|
||||||
Tone.MonoSynth = function(options){
|
Tone.MonoSynth = function(options){
|
||||||
|
@ -20,39 +20,39 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first oscillator
|
* The oscillator.
|
||||||
* @type {Tone.OmniOscillator}
|
* @type {Tone.OmniOscillator}
|
||||||
*/
|
*/
|
||||||
this.oscillator = new Tone.OmniOscillator(options.oscillator);
|
this.oscillator = new Tone.OmniOscillator(options.oscillator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the frequency control signal
|
* The frequency control.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.frequency = this.oscillator.frequency;
|
this.frequency = this.oscillator.frequency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the detune control signal
|
* The detune control.
|
||||||
* @type {Cents}
|
* @type {Cents}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.detune = this.oscillator.detune;
|
this.detune = this.oscillator.detune;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the filter
|
* The filter.
|
||||||
* @type {Tone.Filter}
|
* @type {Tone.Filter}
|
||||||
*/
|
*/
|
||||||
this.filter = new Tone.Filter(options.filter);
|
this.filter = new Tone.Filter(options.filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the filter envelope
|
* The filter envelope.
|
||||||
* @type {Tone.Envelope}
|
* @type {Tone.Envelope}
|
||||||
*/
|
*/
|
||||||
this.filterEnvelope = new Tone.ScaledEnvelope(options.filterEnvelope);
|
this.filterEnvelope = new Tone.ScaledEnvelope(options.filterEnvelope);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the amplitude envelope
|
* The amplitude envelope.
|
||||||
* @type {Tone.Envelope}
|
* @type {Tone.Envelope}
|
||||||
*/
|
*/
|
||||||
this.envelope = new Tone.AmplitudeEnvelope(options.envelope);
|
this.envelope = new Tone.AmplitudeEnvelope(options.envelope);
|
||||||
|
|
|
@ -36,12 +36,14 @@ define(["Tone/core/Tone", "Tone/instrument/Instrument", "Tone/signal/Signal"], f
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trigger the attack. start the note, at the time with the velocity
|
* Trigger the attack. Start the note, at the time with the velocity
|
||||||
*
|
*
|
||||||
* @param {Frequency} note the note
|
* @param {Frequency} note the note
|
||||||
* @param {Time} [time=now] the time, if not given is now
|
* @param {Time} [time=now] the time, if not given is now
|
||||||
* @param {number} [velocity=1] velocity defaults to 1
|
* @param {number} [velocity=1] velocity defaults to 1
|
||||||
* @returns {Tone.Monophonic} this
|
* @returns {Tone.Monophonic} this
|
||||||
|
* @example
|
||||||
|
* synth.triggerAttack("C4");
|
||||||
*/
|
*/
|
||||||
Tone.Monophonic.prototype.triggerAttack = function(note, time, velocity) {
|
Tone.Monophonic.prototype.triggerAttack = function(note, time, velocity) {
|
||||||
time = this.toSeconds(time);
|
time = this.toSeconds(time);
|
||||||
|
@ -51,9 +53,11 @@ define(["Tone/core/Tone", "Tone/instrument/Instrument", "Tone/signal/Signal"], f
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trigger the release portion of the envelope
|
* Trigger the release portion of the envelope
|
||||||
* @param {Time} [time=now] if no time is given, the release happens immediatly
|
* @param {Time} [time=now] if no time is given, the release happens immediatly
|
||||||
* @returns {Tone.Monophonic} this
|
* @returns {Tone.Monophonic} this
|
||||||
|
* @example
|
||||||
|
* synth.triggerRelease();
|
||||||
*/
|
*/
|
||||||
Tone.Monophonic.prototype.triggerRelease = function(time){
|
Tone.Monophonic.prototype.triggerRelease = function(time){
|
||||||
this._triggerEnvelopeRelease(time);
|
this._triggerEnvelopeRelease(time);
|
||||||
|
@ -79,6 +83,7 @@ define(["Tone/core/Tone", "Tone/instrument/Instrument", "Tone/signal/Signal"], f
|
||||||
* @param {Frequency} note if the note is a string, it will be
|
* @param {Frequency} note if the note is a string, it will be
|
||||||
* parsed as (NoteName)(Octave) i.e. A4, C#3, etc
|
* parsed as (NoteName)(Octave) i.e. A4, C#3, etc
|
||||||
* otherwise it will be considered as the frequency
|
* otherwise it will be considered as the frequency
|
||||||
|
* @param {Time} [time=now] The time when the note should be set.
|
||||||
* @returns {Tone.Monophonic} this
|
* @returns {Tone.Monophonic} this
|
||||||
*/
|
*/
|
||||||
Tone.Monophonic.prototype.setNote = function(note, time){
|
Tone.Monophonic.prototype.setNote = function(note, time){
|
||||||
|
|
|
@ -10,7 +10,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Instrument}
|
* @extends {Tone.Instrument}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var noiseSynth = new Tone.NoiseSynth();
|
* var noiseSynth = new Tone.NoiseSynth();
|
||||||
|
|
|
@ -7,7 +7,7 @@ define(["Tone/core/Tone", "Tone/instrument/Instrument", "Tone/source/Noise", "To
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Instrument}
|
* @extends {Tone.Instrument}
|
||||||
* @param {Object} options see the defaults
|
* @param {Object} [options] see the defaults
|
||||||
* @example
|
* @example
|
||||||
* var plucky = new Tone.PluckSynth();
|
* var plucky = new Tone.PluckSynth();
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@ function(Tone){
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Instrument}
|
* @extends {Tone.Instrument}
|
||||||
* @param {Object|string} urls the urls of the audio file
|
* @param {Object|string} urls the urls of the audio file
|
||||||
* @param {Object} options the options object for the synth
|
* @param {Object} [options] the options object for the synth
|
||||||
* @example
|
* @example
|
||||||
* var sampler = new Sampler({
|
* var sampler = new Sampler({
|
||||||
* A : {
|
* A : {
|
||||||
|
@ -58,6 +58,7 @@ function(Tone){
|
||||||
/**
|
/**
|
||||||
* The name of the current sample.
|
* The name of the current sample.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
this._sample = options.sample;
|
this._sample = options.sample;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var synth = new Tone.SimpleAM();
|
* var synth = new Tone.SimpleAM();
|
||||||
|
@ -22,13 +22,13 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first voice
|
* The carrier voice.
|
||||||
* @type {Tone.SimpleSynth}
|
* @type {Tone.SimpleSynth}
|
||||||
*/
|
*/
|
||||||
this.carrier = new Tone.SimpleSynth(options.carrier);
|
this.carrier = new Tone.SimpleSynth(options.carrier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the second voice
|
* The modulator voice.
|
||||||
* @type {Tone.SimpleSynth}
|
* @type {Tone.SimpleSynth}
|
||||||
*/
|
*/
|
||||||
this.modulator = new Tone.SimpleSynth(options.modulator);
|
this.modulator = new Tone.SimpleSynth(options.modulator);
|
||||||
|
|
|
@ -9,7 +9,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
* @example
|
* @example
|
||||||
* var fmSynth = new Tone.SimpleFM();
|
* var fmSynth = new Tone.SimpleFM();
|
||||||
|
@ -20,14 +20,14 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first voice
|
* The carrier voice.
|
||||||
* @type {Tone.SimpleSynth}
|
* @type {Tone.SimpleSynth}
|
||||||
*/
|
*/
|
||||||
this.carrier = new Tone.SimpleSynth(options.carrier);
|
this.carrier = new Tone.SimpleSynth(options.carrier);
|
||||||
this.carrier.volume.value = -10;
|
this.carrier.volume.value = -10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the second voice
|
* The modulator voice.
|
||||||
* @type {Tone.SimpleSynth}
|
* @type {Tone.SimpleSynth}
|
||||||
*/
|
*/
|
||||||
this.modulator = new Tone.SimpleSynth(options.modulator);
|
this.modulator = new Tone.SimpleSynth(options.modulator);
|
||||||
|
@ -49,8 +49,6 @@ function(Tone){
|
||||||
this.harmonicity.units = Tone.Type.Positive;
|
this.harmonicity.units = Tone.Type.Positive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* @type {Tone.Multiply}
|
* @type {Tone.Multiply}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,7 +9,7 @@ function(Tone){
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Monophonic}
|
* @extends {Tone.Monophonic}
|
||||||
* @param {Object} options the options available for the synth
|
* @param {Object} [options] the options available for the synth
|
||||||
* see defaults below
|
* see defaults below
|
||||||
*/
|
*/
|
||||||
Tone.SimpleSynth = function(options){
|
Tone.SimpleSynth = function(options){
|
||||||
|
@ -19,27 +19,27 @@ function(Tone){
|
||||||
Tone.Monophonic.call(this, options);
|
Tone.Monophonic.call(this, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the first oscillator
|
* The oscillator.
|
||||||
* @type {Tone.OmniOscillator}
|
* @type {Tone.OmniOscillator}
|
||||||
*/
|
*/
|
||||||
this.oscillator = new Tone.OmniOscillator(options.oscillator);
|
this.oscillator = new Tone.OmniOscillator(options.oscillator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the frequency control signal
|
* The frequency control.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.frequency = this.oscillator.frequency;
|
this.frequency = this.oscillator.frequency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the detune control signal
|
* The detune control.
|
||||||
* @type {Cents}
|
* @type {Cents}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.detune = this.oscillator.detune;
|
this.detune = this.oscillator.detune;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the amplitude envelope
|
* The amplitude envelope.
|
||||||
* @type {Tone.Envelope}
|
* @type {Tone.Envelope}
|
||||||
*/
|
*/
|
||||||
this.envelope = new Tone.AmplitudeEnvelope(options.envelope);
|
this.envelope = new Tone.AmplitudeEnvelope(options.envelope);
|
||||||
|
|
Loading…
Reference in a new issue