Tone.js homepage
Docs are autogenerated from jsdoc-style comments in the source code, examples are copied from the main repository. To fix any typos or errors, please submit a pull request to the Tone.js repo.
A Web Audio framework for making interactive music in the browser.
Home Page: https://tonejs.github.io
License: MIT License
Tone.js homepage
Docs are autogenerated from jsdoc-style comments in the source code, examples are copied from the main repository. To fix any typos or errors, please submit a pull request to the Tone.js repo.
I believe this is related to either the LowpassCombFilter or the FeedbackCombFilter. Both cause chrome to "Aw, Snap!" occasionally during tests. Classes that use these nodes are also susceptible: Freeverb, JCReverb, and PluckSynth.
Seems to be related to a Chrome 38 release.
I've reported the bug here. Hopefully it is addressed soon.
this should include some common style.css and guidelines for the look of the examples
combined with a "set" method it'll be very easy to go to and from JSON representations which will make creating and saving presets very simple.
Better for international support if we specify UTF-8 encoding in head.
Or maybe this could be an option with Tone.Scale or another class like Tone.ExpScale.
The scaling could easily be done with a WaveShaperNode as long as the input was between -1 and 1.
This would be useful for scaling frequency values with Tone.AutoWah
All classes in the signal folder should borrow the Signal.connect method which zeros out the value of the Param or Signal which is it connect to so that the Signal can get full control over the output value without being summed with the current Param or Signal's value. This will save having to manually zero out the connected parameter which is not intuitive.
Not sure what the best way to handle this is. Possibly just doing something like this would work:
Tone.[Class].prototype.connect = Tone.Signal.prototype.connect
Also, not sure how to handle this case in the jsdocs.
Feature request
Enable the transport to send its ticks to other/multiple destinations. A function like 'setListener' adds a callback which will be executed at each tick.
Why?
I'd like to create multiple 'smaller' transports (with their own loop points), but have them in the same BPM as the global transport. Creating a new clock for each transport seems unnecessary and using the ticks of the main transport would be perfect!
Thank you!
examples which start audio processes from the time of load (such as signalProcessing ) require that a user input start the AudioContext. the solution is to bind a button or UI object to Tone.startMobile().
This will also need to be added to the tests so tests will be started manually with a button.
Hi,
I've noticed a bug when starting and stopping LFO's. You can replicate on your example by pressing start and stop a few times and you'll notice that the sound completely changes.
Thanks
this page might be useful.
best way to do this would be using the PeriodicWave of the oscillator.
this might require setting up an initialize routine for certain modules like Tone.Signal which use the context on init.
At least two Oscillators chained together with independent Envelopes.
This method will take all of the arguments as an object to be able to set them at once. It will make it much easier to create presets as JSON.
this is a good approach:
https://github.com/pendragon-andyh/WebAudio-PulseOscillator
simple and efficient.
Tone.PulseOscillator should have a width parameter which can accept Signal control or an Oscillator to achieve a PWM effect.
Been going around in circles trying to figure out why this sketch I was making with Tone.js was giving me grief on mobile (using Chrome/Safari on an iPhone) - realized if I swapped plain Oscillators in instead of MonoSynths then it worked.
Ended up rebuilding the MonoSynth chain, I think pretty much piece-by-piece, just in my sketch, and it works. But if I swap in MonoSynths again it breaks. Tested this on a completely simplified 'just touch the canvas' and it plays a note type of scenario and it seems to hold true - works fine on desktop, no output on mobile if it's using MonoSynth. Noticed the Synth Examples don't seem to play on iOS mobile either so wanted to notify that there could be something wrong. I'm really new to programming so I could just be doing something wrong though.
The constant signal generator at the heart of Tone.Signal is currently an Oscillator through a WaveShaper, but it could be simplified to just be a Buffer where the output is always 1 set to loop.
I'm not sure this is possible in tone.js? I just want a basic sine wave with a sin envelope start from 0 to 1, and end at 1. Or any ohter envelope like triangle
I'm trying to use a Tone.Signal as a gain node, but when I set new values I hear a slight crackling sound but no change to the gain. Is this the right way to use Signals?
this.Effect = new Tone.Signal(1, 'db');
this.Effect.value = newValue;
I've tried using different units but I still can't get it work.
Right now they use Recorder (which should probably be deprecated), and are susceptible to all kinds of slowdowns in the main thread which can cause the tests to fail (#9). They should instead be using the OfflineRenderingContext which will be faster and more accurate.
Dispose methods should use Tone.prototype.dispose.call(this)
if they extend Tone, and if they extend a subclass, they should call Tone.Parent.prototype.dispose.call(this)
.
Additionally this scheme makes it possible to remove manual disposing / disconnecting of this.input and this.output.
With Tone.Player, I notice that after using .setLoopStart()
and .setLoopEnd()
, the changes only go into effect when I execute .start()
to restart the player.
It would be great to change this so that .setLoopStart()
etc all actually affect Player._source
so that users can dynamically change granular playback position without restarting the player. Or, maybe this is outside of the design goals for the Player?
When calling stop
(without a second argument) on a Tone.Clock
, it tries to execute onend
but it's undefined.
Chrome throws the following error:
Uncaught TypeError: onend is not a function
It breaks the whole function containing the stop
call.
A jsfiddle example:
http://jsfiddle.net/rn76Ly4n/1/
Just curious why don't you disconnect the sources when you Tone.Player.stop
https://github.com/TONEnoTONE/Tone.js/blob/master/Tone/source/Player.js#L196
It looks like you only disconnect when Tone.Player.dispose
is called. Couldn't this create a lot of memory build up if you call Tone.Player.play
many times?
Hey Yotam,
If you connect an Tone.Oscillator to either one of these effects the sound only comes out the left side.
Strangely though, if you connect a Tone.Noise or a Tone.Microphone to these effects it works and they are in stereo. I can't work out what's causing this. Have you come across this?
Thanks
Feature request: PitchShift effect, i.e. that could be applied to an input source / media element source node. If you ever have time for it, this would be awesome!
Try a chorus and set it's depth to something above 1 and you can hear that one of the LFOs aren't smoothly oscillating. It sounds a bit like it's set to a pulse wave.
Previously you used to be able to set the depth and delaytime high values and it would add interesting harmonies which sounded great.
I've got an issue with the Convolver in r4. Seems like the convolver buffer isn't being set.
this.Effect = new Tone.Convolver("../Assets/ImpulseResponses/teufelsberg01.wav");
this.Effect._convolver.buffer = null
Tone.LessThan(value) could be simplified to Tone.Adder(-value) --> Tone.Threshold(0)
and Tone.GreaterThan(value) could be simplified to Tone.Negate() --> Tone.LessThan(-value)
This will simplify the classes that need to be maintained since logic dealing with WaveShaperNodes have proven to be a little tricky sometimes.
It's because of the call to setTick in the stop method. i should bind to the onend event of the oscillator so that the tick is set to 0 only after the oscillator has stopped.
many tests fail and leave code which needs cleaning up, like an uninvoked "dispose" method. sometimes this seems to cause failures in the later tests.
an initial delay on the left channel of half the delay time should fix this
Hi, is there anyway to get the current frequency value from an oscillator?
Oscillator.frequency.value is a Tone.Signal so I'm unsure how to get the value as a number.
Thanks
not all of the tests currently pass on firefox.
Hey there,
Line 93 in Microphone.js gives "Uncaught TypeError: undefined is not a function".
this._stream.disconnect();
Seems to work fine without it. What do you recon?
Big API changes in r4: moving most of the setSomething
/ getSomething
methods over to ES5 getter/setter interfaces.
Overall it makes the library much more consistent, readable, and expressive. Hopefully this isn't a problem with TypeScript.
It used to be in there, but got lost in the r4.
Related to #67
They seem to work only on certain browsers in certain situations. This can cause bugs like the transport not being able to stop and restart in FireFox.
Replace bindings to the native onended
events with a setTimeout
instead.
Hey, I'm not sure that that setFeedback is working as it should.
On line 38 of the pingPingDelay.html example change to:
feedbackDelay.setFeedback(2);
This will give you an infinite feedback which you'd expect to get if you set it to 1.
Also setting this to 0 still gives some feedback. Should it not stop feedback completely?
Hey Yotam,
Is there a way to disconnect a specific node?
At the moment, when you use the disconnect method it disconnects all the nodes which can be a bit problematic. If you want to only disconnect one node, you then have to reconnect up everything else. Sometimes this can be difficult, especially if you don't know all of the nodes currently connected.
Do you know a way of getting round this?
Really great work on the new release!
the set method sets all of the attributes at once.
Here's an approach to that looks promising.
https://github.com/pendragon-andyh/WebAudio-PulseOscillator
If we were able to translate all of the types of waveforms into a PeriodicWaveform, then it would also be possible to set the phase potentially (#18).
I will remove the build which is currently at the top level and all builds (Tone.js, Tone.min.js, Tone.Presets.js) will go to the build folder. References in the examples and documentation will need to be updated.
I'm having a blast experimenting with Tone.js, what a great tool.
I'm attempting to use the Sampler object to play a short loop and affect its amplitude with an envelope. In this example, I want the loop to start playing immediately when I click, and fade out over 10 seconds when I release. However, the fade out only lasts about a second no matter what value I specify for the release
parameter.
Am I misunderstanding how the sampler and envelope work?
Here's a sample page illustrating the problem: http://etienne.github.io/tonetest/
And here's the relevant code:
var sampler = new Tone.Sampler({
"url" : 'mp3/A1.mp3',
"envelope" : {
"attack" : 0,
"decay" : 0,
"sustain" : 1,
"release" : 10
}
});
sampler.player.loop = true;
sampler.player.loopStart = 0.1;
sampler.player.loopEnd = 0.11;
sampler.toMaster();
window.onmousedown = function(event) {
sampler.triggerAttack();
};
window.onmouseup = function(event) {
sampler.triggerRelease();
};
Hey,
When using envelopes with qwertyhancock the attack isn't triggering properly when you switch between notes quickly. On your synth examples if you use the keyboard and switch between notes quickly and hold the second down, you don't hear the sustain. Any way to fix this?
When calling stop
on a Tone.Clock
, Tone.Transport
stops ticking in Firefox (Developer Edition). Tone.Transport
still thinks it's running.
It should only stop Tone.Clock
, works as expected in Chrome and Safari.
This jsfiddle shows the issue.
http://jsfiddle.net/v18c4o0j/
Move the array outside of the prototype will allow the arrays to be reused without having to recreate them each time.
It would be more elegant, and also work better with the instruments like Tone.MonoSynth if Tone.Envelope took its parameters as an object such as:
{
"attack" : 0.001,
"decay" : 0.4,
...
}
Eventually perhaps all Tones will be able to accept their arguments as objects for consistency.
There is a bug in Chrome 42 which causes the AudioBufferSourceNode not to loop when invoked with an offset. It is already fixed on Chrome 43.
I will address the issue on the dev
branch, but Chrome 43 will probably be released before the dev
branch makes it into master
. This is not a problem in FF and Safari.
should reintroduce "use strict" to all of the classes for best practices sake.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.