Commit graph

507 commits

Author SHA1 Message Date
tambien
39cf110fe4 Merge branch 'dev' of https://github.com/Tonejs/Tone.js into typescript 2019-05-21 23:53:46 -04:00
Stephan Lagerwaard
01670b2644 Change const to var for ES5 compatibility (#488) 2019-05-13 09:29:41 -04:00
tambien
184102ab4c removing shims
will replace with standardized-audio-context
2019-03-25 22:58:36 -07:00
tambien
75fc8c3874 fixing docs
[skip ci]
2019-03-25 19:44:58 -07:00
tambien
3c2d1250ea passes in the player to the callback
fixes #460
2019-03-25 11:53:57 -07:00
tambien
56800fe11b Disconnecting but not disposing onend
addresses #463
2019-03-19 20:26:28 -04:00
tambien
ae8be83cc5 fixing typo
fixes #462
2019-03-14 10:29:51 -04:00
tambien
023758425b use the playbackRate when computing the offset of a synced player
fixes #349
2019-03-12 11:25:33 -04:00
tambien
a3cc8d0f60 guarding against double disposing 2019-03-08 13:01:09 -05:00
tambien
a23ba73fc4 dispose oscillator onended 2019-03-08 12:17:27 -05:00
tambien
57d30ff6d6 optimizing case of basic oscillator types
fixes #427
2019-03-08 12:17:20 -05:00
tambien
d601b4be3a dispose the buffer onended
addresses #378
2019-03-08 11:30:00 -05:00
tambien
c023181579 linting 2019-02-15 13:03:10 -05:00
tambien
cb156fc6a3 no need to test if _wave exists
should always exist
2019-02-01 11:50:15 -05:00
tambien
a9adacb794 using Tone.connect for native nodes 2019-01-28 11:55:48 -05:00
tambien
2780cac504 using Tone.connect for connections with native nodes
addresses #421
2019-01-28 11:02:15 -05:00
tambien
610b847f4d fixing docs 2019-01-27 17:14:04 -05:00
tambien
87909ca4a3 BufferSourceNode shim is no longer needed
fixed issue in Safari which was resolved
2019-01-27 13:52:23 -05:00
tambien
ed71d8141b amd to es6 import/export
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
2019-01-27 13:05:20 -05:00
tambien
0ba72ac93a clamping start/stop time to currentTime
this way if someone passes in start(0), it will just play immediately and not break things.

addresses #424
2019-01-23 16:19:07 -05:00
tambien
ffe3d434c6 closes the stream before reopening it 2019-01-08 11:26:57 -05:00
tambien
e739c4f1f3 adding baseType to all oscillators
makes getting/setting through interface easier
2019-01-08 00:13:48 -05:00
tambien
1ca4242323 'get' does not return partials array for basic types 2018-12-28 16:00:03 -05:00
tambien
0c10c80b12 only set the stop when it's not synced
otherwise it reschedules multiple stops
2018-12-26 15:42:05 -05:00
tambien
fd62e31a94 loaded boolean indicates when GrainPlayer is loaded
consistent with Tone.Player
2018-12-23 18:13:57 -05:00
tambien
9178798993 computed duration can be longer than the buffer length
because of playback rate changes, the duration can be longer than the buffer duration.

fixes #375
2018-12-23 13:50:02 -05:00
tambien
795e0d90d7 removing position tracking from player
fixes #361
2018-12-23 13:46:52 -05:00
tambien
c20f703c40 making sure that the type is never set to custom+partialCount 2018-12-21 15:31:36 -05:00
tambien
6c748e3e9d get and set the sourceType
this allows slight decoupling from combining everything in the 'type' string
2018-12-21 15:29:08 -05:00
tambien
f199af1f31 setting gain to 0 initially keeps it from popping 2018-12-17 12:41:14 -05:00
tambien
81f6ae1144 testing that a type can be passed into the constructor as an object
and gotten with the 'get()' method
2018-12-09 20:40:46 -05:00
tambien
85a606d81d documenting partialCount
[skip ci]
2018-12-09 18:58:47 -05:00
tambien
761de621d8 adding partialCount parameter
offers alternative "non string" way to set the partials to an osc type
2018-12-09 18:45:01 -05:00
Paul Varache
cfa23cfd24 Make noiseArrays generate samples lazily (#386)
* Make noiseArrays generate samples lazily

* getter -> get

* Create noiseBuffers instead of arrays

fixes #384
2018-09-10 14:20:02 -04:00
tambien
3d1202043a all modules are relative paths
simplifies deep references to individual files
2018-08-26 22:29:17 -04:00
tambien
ca5dccf1cb extends AudioNode 2018-07-30 13:30:21 -04:00
Yotam Mann
f76beaf916 moving to updated BufferSource fade out api
Player still fades from the end
2018-06-20 15:08:16 -04:00
Yotam Mann
fec49b6936 stops clock after 1 iteration when loop = false
removing seek method. adjusts for playbackRate when scheduling grain duration
2018-06-20 14:57:42 -04:00
Yotam Mann
405a841db0 stop method is beginning of fadeOut curve instead of end
simplifies code

fixes #328
2018-06-20 14:55:43 -04:00
tambien
2d1c2dc705 no noise supression 2018-06-13 15:57:05 -04:00
Yotam Mann
26df78b0db handles start/stop/restart better in many situations
less prone to errors where the OscillatorNode is silent after starting
2018-06-12 23:48:15 -04:00
Yotam Mann
ebbb1ef8bb log and assert help in debugging classes 2018-06-12 23:47:30 -04:00
tambien
534b97bea4 removing unnecessary type from TickSignal 2018-06-05 22:56:47 -04:00
Yotam Mann
bbf2929b6f rotating the phase of the oscillator group
addresses #354
2018-05-29 10:35:12 -04:00
Yotam Mann
4cb60ca111 Merge branch 'dev' of https://github.com/Tonejs/Tone.js into dev 2018-05-28 18:06:44 -04:00
Yotam Mann
5b20f572a3 removing unused lines 2018-05-28 18:01:19 -04:00
tambien
b8c5353638 Merge branch 'dev' of https://github.com/Tonejs/Tone.js into dev 2018-05-24 16:58:21 -04:00
Yotam Mann
54276555f2 correctly restarting PulseOscillator 2018-05-20 17:36:07 -04:00
Yotam Mann
ee18f87106 assign basic oscillator type
typo!
2018-05-20 17:25:39 -04:00
Yotam Mann
a7b783b0a5 updating docs
[skip ci]
2018-05-19 15:07:58 -04:00
tambien
9b78520038 noting that Oscillator is better for most cases 2018-05-17 18:38:53 -04:00
Charles Holbrow
51ac1a2100 Sampler Instrument can play entire sample, even when pitch shifting down. (#335)
* Sampler instrument does not truncate playback when pitch shifting down

* `BufferSource.start` defaults to playing the entire buffer, respects `this.playbackRate`

Previously, the Buffer would truncate the sample when `playbackRage` is less than 1.

Within the `start` method, this commit also tightens the scope of `var computedDur`, so
that it is accessible only where it is used.
2018-04-25 14:27:50 -04:00
Yotam Mann
18fa10086d making the inner forEachBetween exclusive of the end time 2018-03-30 17:57:35 -04:00
Yotam Mann
433cd78689 fixing infinite loop when stop and start are scheduled at the same time
validating change with test
2018-03-30 13:15:53 -04:00
Yotam Mann
65f15a1ef2 restart method to all the oscillators 2018-03-06 00:02:49 -05:00
Yotam Mann
7a5b872f76 using more accurate seconds counter for syncedStop 2018-03-05 22:29:00 -05:00
Yotam Mann
8c2acd03d5 removing retrigger, maintaining array of activeSources 2018-03-05 22:26:37 -05:00
Yotam Mann
5ded029206 getSecondsAtTime returns elapsed seconds
also invoking event immediately if the window has already passed
2018-03-05 22:25:57 -05:00
Yotam Mann
103f01bdc7 getState at time, does not throw error if already stopped 2018-03-05 22:25:12 -05:00
Yotam Mann
dcd5a0d0e9 documenting getStateAtTime 2018-03-05 13:00:45 -05:00
Yotam Mann
a5503e02d2 linting 2018-03-05 12:25:33 -05:00
Yotam Mann
a80ae0656b Tone.isDefined replaces !Tone.isUndef 2018-03-05 11:32:08 -05:00
Yotam Mann
701092d6e2 Fixing documentation error
fixes #316
2018-03-05 10:31:32 -05:00
Yotam Mann
efa06f43f1 testing that the stop event is not the first event 2018-03-01 14:44:20 -05:00
Yotam Mann
3d0a8005b7 removing isPast warning
clutters up tests, rarely helpful for debugging
2018-03-01 14:38:40 -05:00
Yotam Mann
4dd5c0a464 get the playback position of the playing buffer
integrates TickSource to track position even with playbackRate changes

Fixes #292 and Fixes #307
2018-03-01 14:15:37 -05:00
Yotam Mann
d98b10d6f8 documenting oscillator node 2018-03-01 14:08:35 -05:00
Yotam Mann
23932cbfa6 can cancel scheduled stop and setTick events 2018-03-01 14:06:03 -05:00
Yotam Mann
40530e3c16 'stop' is invoked on the last scheduled stop value 2018-03-01 14:02:11 -05:00
Yotam Mann
f06516d76d TickSource handles pause events
more flexible and accurate timing calculations
2018-02-27 17:02:17 -05:00
Yotam Mann
cf138c03b4 TickSource tracks elapsed ticks can start/stop
no pause yet
2018-02-25 17:25:32 -05:00
Yotam Mann
65f166570b Sources call 'restart' method if already started when 'start' is invoked 2018-02-08 11:10:53 -05:00
Yotam Mann
5eec68f9d0 compare rendered output to previously rendered audio files 2018-02-05 13:55:37 -05:00
Yotam Mann
a99e582c3c correctly handles changing playbackRate after source is started 2018-02-05 13:54:16 -05:00
Yotam Mann
457c7b221c optimizing instrument by only turning on oscillators when active 2018-02-05 13:50:14 -05:00
Yotam Mann
2fe32576ed using OscillatorNode in Oscillator 2018-02-05 00:40:53 -05:00
Yotam Mann
0ee67d8445 proper disposal of timeout 2018-02-05 00:40:42 -05:00
Yotam Mann
f086f58c75 OscillatorNode is a fire-and-forget Oscillator 2018-02-04 22:55:19 -05:00
Yotam Mann
c004145dc0 optimizing basic waveform case 2018-02-04 11:33:54 -05:00
Yotam Mann
177130ec36 BufferSourceNode shim for OfflineAudioContext on iOS
addresses #237
2018-01-21 22:33:02 -05:00
Yotam Mann
87217d1ab4 does not invoke stop from start in case playbackRate changes
fixes #292
2018-01-17 13:18:51 -05:00
Yotam Mann
fd84c251f7 eslinting 2018-01-03 12:07:06 -05:00
Yotam Mann
dded291a25 linting 2018-01-02 10:37:27 -05:00
Yotam Mann
077ae6d69a Source sync and start after Transport is already running 2018-01-02 10:35:39 -05:00
Yotam Mann
8ed7a87b45 correcting spelling 2017-12-29 20:44:16 -05:00
Yotam Mann
5ba49351d9 additional safety flag for if the internal BufferSourceNode is actually started
checking if the offset < duration keeps safari from going into invalid
state
2017-12-28 18:43:53 -05:00
Yotam Mann
3f996c2bc0 requiring BufferSource 2017-12-28 18:43:05 -05:00
Yotam Mann
e3d9cd136a use 'this.now()' instead of Tone.now() 2017-12-27 11:45:37 -05:00
Yotam Mann
e4380a048b player can be constructed with unloaded Tone.Buffer
onload callback is invoked when the Buffer parameter is loaded

fixes #273
2017-12-15 23:06:06 -05:00
Yotam Mann
528882be53 does not require device and deviceId in gUM 2017-11-29 15:38:25 -05:00
Yotam Mann
3e7e351e4a fixing typo in else statement 2017-11-29 15:27:01 -05:00
Yotam Mann
f5e6d973c9 only throw 'no matching device error' when a specific device is requested 2017-11-29 15:22:58 -05:00
Yotam Mann
4316530b16 linting 2017-10-26 16:03:00 -04:00
Yotam Mann
c58fad41f0 linting 2017-10-26 15:26:04 -04:00
Yotam Mann
7a870296bc linting 2017-10-26 01:07:53 -04:00
Yotam Mann
903c87ff72 user media does not look for 'default'
instead takes the first device if nothing is specified
2017-10-26 00:50:22 -04:00
Yotam Mann
9400091609 modulus the offset by the duration in case the offset > duration 2017-10-25 23:05:30 -04:00
Yotam Mann
305fdc02da moving shim to another file 2017-10-25 23:00:37 -04:00
Yotam Mann
0d85d90f5c reducing volume further 2017-10-25 23:00:20 -04:00
Yotam Mann
a82ab45132 linting 2017-10-25 17:57:52 -04:00
Yotam Mann
cb2a982c39 linting 2017-10-21 19:02:46 -04:00
Yotam Mann
d61a22e7f4 linting 2017-10-21 13:52:06 -04:00
Yotam Mann
da26a1c94c keeps track of BufferSources on the state timeline
addresses #258
2017-10-21 13:49:48 -04:00
Yotam Mann
916430ac2e increasing the memory of the state timeline 2017-10-21 13:44:54 -04:00
Tim Pulver
202f6fd03f Fix doc: singular -> plural (#264) 2017-09-29 10:26:50 -04:00
Yotam Mann
6d38440379 using exponentialApproachValueAtTime 2017-09-20 19:04:49 -04:00
Yotam Mann
4abe8a78cf stop the source to allow for garbage collection 2017-09-19 22:45:40 -04:00
Yotam Mann
b8648cc8ac removing deprecated MultiPlayer class 2017-09-17 12:31:25 -04:00
Yotam Mann
39389e810c warning if scheduling time is in the past
addresses #260
2017-09-15 17:50:12 -04:00
Yotam Mann
33e7bd0c13 adding "curve" to BufferSource fades 2017-09-13 18:30:43 -04:00
Yotam Mann
e6faa39dba classes which generate or process sound extend Tone.AudioNode 2017-08-27 17:50:31 -04:00
Yotam Mann
ffa4cbd0f0 updating comment to reflect that it extends Tone.Source 2017-08-27 16:25:43 -04:00
Yotam Mann
5fe3e9106c using async callback for getting context
for classes that need it on init
2017-08-13 21:37:32 -04:00
Yotam Mann
faee7175e1 added link in deprecation notice 2017-08-08 20:50:55 -04:00
Yotam Mann
62e05f6d57 styling
[skip ci]
2017-06-26 18:19:30 -04:00
Yotam Mann
d69770eea3 don't remove all of the Transport synced events with Source.unsync 2017-06-21 17:28:50 -04:00
Yotam Mann
e105387072 Players can fadeIn/Out 2017-06-19 15:18:50 -04:00
Yotam Mann
83866e6492 adding fadeIn/Out to Player 2017-06-19 15:11:15 -04:00
Yotam Mann
2de449b74c fadeOut is subtracted from end of the sample
instead of the stop time being the beginning of the fade out.
2017-06-19 15:03:10 -04:00
Yotam Mann
59a276d8fe including lookAhead in now() removes need for adding blockTime to reduce clicks 2017-05-28 21:52:28 -04:00
Yotam Mann
81df4a9a0e deprecating multiplayer
use Tone.Players instead
2017-05-28 21:38:31 -04:00
Yotam Mann
edf14cffe4 GrainPlayer no longer uses MultiPlayer
uses BufferSource instead
2017-05-28 21:27:59 -04:00
Yotam Mann
2328413a8f stops playing if invoked with 'stop' at an earlier time
does not stop playing if `stop` is invoked with a later time
2017-05-28 21:20:17 -04:00
Yotam Mann
54b11df1dd simplifying BufferSource playback offset > loopEnd logic 2017-05-23 09:30:17 -04:00
Yotam Mann
ea4078348f don't nullify source when stopped
fixes #241
2017-05-22 16:11:50 -04:00
Yotam Mann
c8c436cbf2 Tone.Players wraps up multiple Tone.Player objects
fixes #215
fixes #217
2017-05-21 20:40:20 -07:00
Yotam Mann
a6bb882758 readonly loaded boolean if the buffer is loaded 2017-05-21 20:25:35 -07:00
Yotam Mann
cb1937062c throwing error when passed in device is not found 2017-05-02 20:58:14 -04:00
Yotam Mann
488299a822 Player uses BufferSource 2017-05-02 12:15:00 -04:00
Yotam Mann
fd25ee83e0 fixing linting errors 2017-05-01 19:00:31 -04:00
Yotam Mann
b760821234 BufferSource.buffer is a Tone.Buffer 2017-05-01 18:52:53 -04:00
Yotam Mann
a5a673f6ed scheduling the stop time at buffer.duration - offset 2017-05-01 18:00:31 -04:00
Yotam Mann
61cad0f1fc BufferSource uses context's setTimeout method for onended
removed source.stop method. stopping now relies entirely on the gain
node.

fixes #230
fixes #233
2017-05-01 17:46:51 -04:00
Yotam Mann
b927395825 making defaultArg static 2017-04-30 15:03:49 -04:00
Yotam Mann
f7b7600ac9 fixing jsdoc errors
[skip ci]
2017-04-30 11:16:35 -04:00
Yotam Mann
4bda177b83 gainToDb, dbToGain, intervalToFrequencyRatio now static functions 2017-04-26 23:21:26 -04:00
Yotam Mann
4bd1044cb4 using only static type queries 2017-04-26 00:27:28 -04:00
Yotam Mann
edfa168713 moving to static type queries
i.e. this.isString -> Tone.isString
2017-04-26 00:24:19 -04:00
Yotam Mann
c544255953 using defaults in last remaining classes 2017-04-26 00:07:10 -04:00
Yotam Mann
2030034494 sources to new defaults api
and es6 classes prep
2017-04-26 00:00:01 -04:00
Yotam Mann
b5d6647c12 optimizing noise array creation
only created on initialization

addresses #216
2017-03-18 14:03:04 -04:00
Yotam Mann
10431589d2 moving shims to their respective files
hopefully simplifies maintenance
2017-03-13 01:12:20 -04:00
Yotam Mann
dba464fcca safety checks for drift
fixes #199
2017-03-05 12:39:43 -05:00
Yotam Mann
9858dbe563 start method takes an optional duration
also includes start method docs

fixes #195
2017-02-20 14:03:36 -05:00
Yotam Mann
7549bdaa1a renaming _initAudioContext() -> on("init") 2017-02-19 11:50:15 -05:00
Yotam Mann
7f06666729 only add a stop event if it's not synced to the Transport
fixes #192
2017-01-30 23:17:14 -05:00
Yotam Mann
9669e70d4f using a local instance instead of the class in example
[skip ci]
2017-01-08 17:20:55 -05:00
Yotam Mann
7f2608ab06 updated example to Promise api
[skip ci]
2017-01-08 17:20:07 -05:00
Yotam Mann
31fe050475 getStateAtTime -> getValueAtTime 2016-12-18 22:14:14 -05:00
Yotam Mann
9c94b89eec renaming addEvent->add, removeEvent->remove, getEvent->get 2016-12-18 21:56:22 -05:00