time
Tone.js has a large set of time-related functions and objects. We
take a look at a few of the various possible approaches. Along the
way we also examined several of the Tone.js data types and how they
work in our code.
Links
These are links to various Tone.js documentation pages, which are
sometimes tricky to find:
- Signals
-- see the part about "Scheduling values" in particular as it relates
to time
- Time
-- various ways of representing time
- Transport
- Transport Time
-- these go into more depth about the Tone.js time system than we did
in class, but possibly very useful for more advanced stuff
- Tone.js API
-- check the various types under the "TYPE" listing at the bottom
of the left-hand scrollable menu (Frequemcy, Time, etc.)
Class Downloads
- week5-html-files.zip
-- all the html/javascript files we created in class (covered below)
Here is a tour through the class work (use your "view source"
option to see the code, or look at the corresponding file in
the archive above):
First we looked at the different ways of representing pitch:
And then looked at time specifying:
We embarked on building a simple sequencer, first using javascript
arrays and our own system of indexing within a Tone.js loop:
- seq1.html
-- basic note
- seq1.html
-- loop the basic note
- seq3.html
-- increment through an array for the sequence
- seq3.html
-- increment through an array for the sequence
- seq4.html
-- add a MIDI number to the 'basenote' MIDI number (set in the html)
Sequencing is so popular that Tone.js has built-in sequencing capabilities:
- tseq1.html
-- set up the basic sequence
- tseq2.html
-- increment bpm "by hand" (and it's not reset!)
- tseq3.html
-- use rampTo() to speed up the sequence (and reset properly)
For the last section of the class, we looked at scheduling various
events and functions using the Tone.js time and transport system.
First we set up 'target' pitches for a DuoSynth:
- schedfreq1.html
-- switch the DuoSynth pitch from an html number input
- schedfreq2.html
-- use rampTo() to glissando to the frequency over a set number of seconds
- schedfreq3.html
-- the fun one: let the code determine the targets and schedule the next
glissando independently
Then we made some "rain":