Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tambien committed Oct 5, 2016
2 parents 4d4065b + 36bfba6 commit c7228ed
Show file tree
Hide file tree
Showing 129 changed files with 7,128 additions and 1,841 deletions.
21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
language: node_js
node_js:
- "4.1"
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
sudo: required
dist: trusty
language: node_js
node_js:
- "4.2"

before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
before_script:
- cd gulp
- npm install -g karma
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### r8

* Transport.seconds returns the progress in seconds.
* Buffer.from/toArray, Float32Array <-> Buffer conversions
* Buffer.slice(start, end) slices and returns a subsection of the Buffer
* Source.sync now syncs all subsequent calls to `start` and `stop` to the TransportTime instead of the AudioContext time.
* e.g. source.sync().start(0).stop(0.8); //plays source between 0 and 0.8 of the Transport
* Transport.on("start" / "stop") callbacks are invoked just before the event.
* Param can accept an LFO description in the constructor or .value
* e.g. param.value = {min : 10, max : 20, frequency : 0.4}
* Time.TimeBase has clone/copy methods.
* Tone.Buffer.prototype.load returns Promise
* Using Tone.Delay and Tone.Gain everywhere
* Patch for Chrome 53+ issue of not correctly scheduling AudioParams with setValueAtTime
* Panner3D and Tone.Listener wrap native PannerNode and AudioListener to give 3D panning ability.


### r7

* MetalSynth creates metalic, cymbal sounds
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Tone.js is a Web Audio framework for creating interactive music in the browser.
* [MsCompose 95 - Autotel](http://autotel.co/mscompose95/)
* [Pedalboard - Micha Hanselmann](https://deermichel.github.io/pedalboard/)
* [Keyboard Boogie - Douglas Tarr](http://douglastarr.com/keyboard-boogie)
* [Reflect - Sydneyzh](http://reflect.sydneyzh.com/)
* [Anxiety - Eve Weinberg, Aaron Montoya-Moraga](http://anxietybrain.net/)
* [Ramsophone - Robert Vinluan](http://robertvinluan.com/Ramsophone/)

Using Tone.js? I'd love to hear it: [email protected]

Expand Down Expand Up @@ -150,7 +153,7 @@ synth.connect(distortion);

# Sources

Tone has a few basic audio sources like [Tone.Oscillator](https://tonejs.github.io/docs/#Oscillator) which has sine, square, triangle, and sawtooth waveforms, a buffer player ([Tone.Player](https://tonejs.github.io/docs/#Player)), a noise generator ([Tone.Noise]((https://tonejs.github.io/docs/#Noise))), two additional oscillator types ([pwm](https://tonejs.github.io/docs/#PWMOscillator), [pulse](https://tonejs.github.io/docs/#PulseOscillator)) and [external audio input](https://tonejs.github.io/docs/#Microphone) (when [WebRTC is supported](http://caniuse.com/#feat=stream)).
Tone has a few basic audio sources like [Tone.Oscillator](https://tonejs.github.io/docs/#Oscillator) which has sine, square, triangle, and sawtooth waveforms, a buffer player ([Tone.Player](https://tonejs.github.io/docs/#Player)), a noise generator ([Tone.Noise](https://tonejs.github.io/docs/#Noise)), a few additional oscillator types ([pwm](https://tonejs.github.io/docs/#PWMOscillator), [pulse](https://tonejs.github.io/docs/#PulseOscillator), [fat](https://tonejs.github.io/docs/#FatOscillator), [fm](https://tonejs.github.io/docs/#FMOscillator)) and [external audio input](https://tonejs.github.io/docs/#Microphone) (when [WebRTC is supported](http://caniuse.com/#feat=stream)).

```javascript
//a pwm oscillator which is connected to the speaker and started right away
Expand Down
17 changes: 9 additions & 8 deletions Tone/component/CrossFade.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/signal/EqualPowerGain"], function(Tone){
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
"Tone/signal/EqualPowerGain", "Tone/core/Gain"], function(Tone){

"use strict";

Expand Down Expand Up @@ -26,19 +27,19 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/signal
*/
Tone.CrossFade = function(initialFade){

Tone.call(this, 2, 1);
this.createInsOuts(2, 1);

/**
* Alias for <code>input[0]</code>.
* @type {GainNode}
* @type {Tone.Gain}
*/
this.a = this.input[0] = this.context.createGain();
this.a = this.input[0] = new Tone.Gain();

/**
* Alias for <code>input[1]</code>.
* @type {GainNode}
* @type {Tone.Gain}
*/
this.b = this.input[1] = this.context.createGain();
this.b = this.input[1] = new Tone.Gain();

/**
* The mix between the two inputs. A fade value of 0
Expand Down Expand Up @@ -95,9 +96,9 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/signal
this.fade = null;
this._invert.dispose();
this._invert = null;
this.a.disconnect();
this.a.dispose();
this.a = null;
this.b.disconnect();
this.b.dispose();
this.b = null;
return this;
};
Expand Down
2 changes: 1 addition & 1 deletion Tone/component/EQ3.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
* @type {GainNode}
* @private
*/
this.output = this.context.createGain();
this.output = new Tone.Gain();

/**
* the multiband split
Expand Down
7 changes: 2 additions & 5 deletions Tone/component/Envelope.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
* env.triggerAttack("+0.5", 0.2);
*/
Tone.Envelope.prototype.triggerAttack = function(time, velocity){
//to seconds
var now = this.now() + this.blockTime;
time = this.toSeconds(time, now);
time = this.toSeconds(time);
var originalAttack = this.toSeconds(this.attack);
var attack = originalAttack;
var decay = this.toSeconds(this.decay);
Expand Down Expand Up @@ -276,8 +274,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
* env.triggerRelease();
*/
Tone.Envelope.prototype.triggerRelease = function(time){
var now = this.now() + this.blockTime;
time = this.toSeconds(time, now);
time = this.toSeconds(time);
var currentValue = this.getValueAtTime(time);
if (currentValue > 0){
var release = this.toSeconds(this.release);
Expand Down
28 changes: 9 additions & 19 deletions Tone/component/FeedbackCombFilter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal", "Tone/core/Param"], function(Tone){
define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
"Tone/core/Param", "Tone/core/Delay", "Tone/core/Gain"], function(Tone){

"use strict";

Expand All @@ -13,44 +14,35 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal", "Tone/co
*/
Tone.FeedbackCombFilter = function(){

Tone.call(this);
var options = this.optionsObject(arguments, ["delayTime", "resonance"], Tone.FeedbackCombFilter.defaults);

/**
* the delay node
* @type {DelayNode}
* @private
*/
this._delay = this.input = this.output = this.context.createDelay(1);
this._delay = this.input = this.output = new Tone.Delay(options.delayTime);

/**
* The amount of delay of the comb filter.
* @type {Time}
* @signal
*/
this.delayTime = new Tone.Param({
"param" : this._delay.delayTime,
"value" : options.delayTime,
"units" : Tone.Type.Time
});
this.delayTime = this._delay.delayTime;

/**
* the feedback node
* @type {GainNode}
* @private
*/
this._feedback = this.context.createGain();
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);

/**
* The amount of feedback of the delayed signal.
* @type {NormalRange}
* @signal
*/
this.resonance = new Tone.Param({
"param" : this._feedback.gain,
"value" : options.resonance,
"units" : Tone.Type.NormalRange
});
this.resonance = this._feedback.gain;

this._delay.chain(this._feedback, this._delay);
this._readOnly(["resonance", "delayTime"]);
Expand All @@ -76,14 +68,12 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal", "Tone/co
Tone.FeedbackCombFilter.prototype.dispose = function(){
Tone.prototype.dispose.call(this);
this._writable(["resonance", "delayTime"]);
this._delay.disconnect();
this._delay.dispose();
this._delay = null;
this.delayTime.dispose();
this.delayTime = null;
this.resonance.dispose();
this.resonance = null;
this._feedback.disconnect();
this._feedback.dispose();
this._feedback = null;
this.resonance = null;
return this;
};

Expand Down
2 changes: 1 addition & 1 deletion Tone/component/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
* var filter = new Tone.Filter(200, "highpass");
*/
Tone.Filter = function(){
Tone.call(this);
this.createInsOuts(1, 1);

var options = this.optionsObject(arguments, ["frequency", "type", "rolloff"], Tone.Filter.defaults);

Expand Down
13 changes: 6 additions & 7 deletions Tone/component/Follower.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define(["Tone/core/Tone", "Tone/signal/Abs", "Tone/signal/Subtract",
"Tone/signal/Multiply", "Tone/signal/Signal", "Tone/signal/WaveShaper", "Tone/type/Type"],
define(["Tone/core/Tone", "Tone/signal/Abs", "Tone/signal/Subtract", "Tone/signal/Multiply",
"Tone/signal/Signal", "Tone/signal/WaveShaper", "Tone/type/Type", "Tone/core/Delay"],
function(Tone){

"use strict";
Expand All @@ -21,7 +21,7 @@ function(Tone){
*/
Tone.Follower = function(){

Tone.call(this);
this.createInsOuts(1, 1);
var options = this.optionsObject(arguments, ["attack", "release"], Tone.Follower.defaults);

/**
Expand Down Expand Up @@ -53,11 +53,10 @@ function(Tone){
this._sub = new Tone.Subtract();

/**
* @type {DelayNode}
* @type {Tone.Delay}
* @private
*/
this._delay = this.context.createDelay();
this._delay.delayTime.value = this.blockTime;
this._delay = new Tone.Delay(this.blockTime);

/**
* this keeps it far from 0, even for very small differences
Expand Down Expand Up @@ -170,7 +169,7 @@ function(Tone){
this._filter = null;
this._frequencyValues.disconnect();
this._frequencyValues = null;
this._delay.disconnect();
this._delay.dispose();
this._delay = null;
this._sub.disconnect();
this._sub = null;
Expand Down
2 changes: 2 additions & 0 deletions Tone/component/FrequencyEnvelope.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ define(["Tone/core/Tone", "Tone/component/ScaledEnvelope", "Tone/component/Envel
},
set : function(min){
this._scale.min = this.toFrequency(min);
//also update the octaves
this.octaves = this._octaves;
}
});

Expand Down
2 changes: 1 addition & 1 deletion Tone/component/Gate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
*/
Tone.Gate = function(){

Tone.call(this);
this.createInsOuts(1, 1);
var options = this.optionsObject(arguments, ["threshold", "attack", "release"], Tone.Gate.defaults);

/**
Expand Down
9 changes: 3 additions & 6 deletions Tone/component/LFO.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,15 @@ function(Tone){
/**
* Sync the start/stop/pause to the transport
* and the frequency to the bpm of the transport
*
* @param {Time} [delay=0] the time to delay the start of the
* LFO from the start of the transport
* @returns {Tone.LFO} this
* @example
* lfo.frequency.value = "8n";
* lfo.sync();
* lfo.sync().start(0)
* //the rate of the LFO will always be an eighth note,
* //even as the tempo changes
*/
Tone.LFO.prototype.sync = function(delay){
this._oscillator.sync(delay);
Tone.LFO.prototype.sync = function(){
this._oscillator.sync();
this._oscillator.syncFrequency();
return this;
};
Expand Down
27 changes: 11 additions & 16 deletions Tone/component/LowpassCombFilter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/core/Param"], function(Tone){
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
"Tone/core/Param", "Tone/core/Gain", "Tone/core/Delay"], function(Tone){

"use strict";

Expand All @@ -15,7 +16,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/c
*/
Tone.LowpassCombFilter = function(){

Tone.call(this);
this.createInsOuts(1, 1);

var options = this.optionsObject(arguments, ["delayTime", "resonance", "dampening"], Tone.LowpassCombFilter.defaults);

Expand All @@ -24,22 +25,22 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/c
* @type {DelayNode}
* @private
*/
this._delay = this.input = this.context.createDelay(1);
this._delay = this.input = new Tone.Delay(options.delayTime);

/**
* The delayTime of the comb filter.
* @type {Time}
* @signal
*/
this.delayTime = new Tone.Signal(options.delayTime, Tone.Type.Time);
this.delayTime = this._delay.delayTime;

/**
* the lowpass filter
* @type {BiquadFilterNode}
* @private
*/
this._lowpass = this.output = this.context.createBiquadFilter();
this._lowpass.Q.value = 0;
this._lowpass.Q.value = -3.0102999566398125;
this._lowpass.type = "lowpass";

/**
Expand All @@ -55,25 +56,20 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/c

/**
* the feedback gain
* @type {GainNode}
* @type {Tone.Gain}
* @private
*/
this._feedback = this.context.createGain();
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);

/**
* The amount of feedback of the delayed signal.
* @type {NormalRange}
* @signal
*/
this.resonance = new Tone.Param({
"param" : this._feedback.gain,
"units" : Tone.Type.NormalRange,
"value" : options.resonance
});
this.resonance = this._feedback.gain;

//connections
this._delay.chain(this._lowpass, this._feedback, this._delay);
this.delayTime.connect(this._delay.delayTime);
this._readOnly(["dampening", "resonance", "delayTime"]);
};

Expand Down Expand Up @@ -102,14 +98,13 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/c
this.dampening = null;
this.resonance.dispose();
this.resonance = null;
this._delay.disconnect();
this._delay.dispose();
this._delay = null;
this.delayTime = null;
this._lowpass.disconnect();
this._lowpass = null;
this._feedback.disconnect();
this._feedback = null;
this.delayTime.dispose();
this.delayTime = null;
return this;
};

Expand Down
Loading

0 comments on commit c7228ed

Please sign in to comment.