diff --git a/index.html b/index.html
index a905713..717406a 100644
--- a/index.html
+++ b/index.html
@@ -57,7 +57,7 @@
}
-
+
diff --git a/src/documentation/engine.ts b/src/documentation/engine.ts
index 5083f36..99dc921 100644
--- a/src/documentation/engine.ts
+++ b/src/documentation/engine.ts
@@ -50,13 +50,12 @@ Let's pause for a moment and explain what is going on:
- Sounds are **composed** by adding qualifiers/parameters that will modify the sound or synthesizer being played (_e.g_ sound('...').blabla(...)..something(...).out(). Think of it as _audio chains_.
${makeExample(
- '"Composing" a sound or making a sound chain',
+ '"Composing" a complex sonic object by making a sound chain',
`
-beat(1) :: sound('pad')
+beat(1) :: sound('pad').n(1)
.begin(rand(0, 0.4))
.freq([50,52].beat())
- .size(0.9)
- .room(0.9)
+ .size(0.9).room(0.9)
.velocity(0.25)
.pan(usine()).release(2).out()`,
true
@@ -110,10 +109,9 @@ ${makeExample(
"Let's make something more complex",
`
beat(0.25) && sound('jvbass')
- .sometimes(s=>s.speed([1,5,10].pick()))
- .room(0.5)
- .gain(1)
- .cutoff(usine(2) * 5000)
+ .sometimes(s=>s.speed([2, 0.5].pick()))
+ .room(0.9).size(0.9).gain(1)
+ .cutoff(usine(1/2) * 5000)
.out()`,
true
)}
@@ -131,7 +129,7 @@ There is a special method to choose the _orbit_ that your sound is going to use:
| Method | Alias | Description |
|----------|-------|------------------------------------------------------------|
-| orbit | o | Orbit number |
+| orbit | o | Orbit number |
## Amplitude
@@ -140,9 +138,9 @@ Simple controls over the amplitude (volume) of a given sound.
| Method | Alias | Description |
|----------|-------|------------------------------------------------------------------------------------|
-| gain | | Volume of the synth/sample (exponential) |
-| velocity | vel | Velocity (amplitude) from 0 to 1. Multipled with gain |
-| dbgain | db | Attenuation in dB from -inf to +10 (acts as a sound mixer fader) |
+| gain | | Volume of the synth/sample (exponential) |
+| velocity | vel | Velocity (amplitude) from 0 to 1. Multipled with gain |
+| dbgain | db | Attenuation in dB from -inf to +10 (acts as a sound mixer fader) |
${makeExample(
"Velocity manipulated by a counter",
@@ -157,21 +155,24 @@ beat(.5)::snd('cp').vel($(1)%10 / 10).out()`,
| Method | Alias | Description |
|---------|-------|-----------------------------------------------|
-| attack | atk | Attack value (time to maximum volume) |
-| decay | dec | Decay value (time to decay to sustain level) |
-| sustain | sus | Sustain value (gain when sound is held) |
-| release | rel | Release value (time for the sound to die off) |
+| attack | atk | Attack value (time to maximum volume) |
+| decay | dec | Decay value (time to decay to sustain level) |
+| sustain | sus | Sustain value (gain when sound is held) |
+| release | rel | Release value (time for the sound to die off) |
Note that the **sustain** value is not a duration but an amplitude value (how loud). The other values are the time for each stage to take place. Here is a fairly complete example using the sawtooth basic waveform.
${makeExample(
"Simple synthesizer",
`
-beat(4)::sound('sawtooth').note(50).decay(0.5).sustain(0.5).release(2).gain(0.25).out();
-beat(2)::sound('sawtooth').note(50+7).decay(0.5).sustain(0.6).release(2).gain(0.25).out();
-beat(1)::sound('sawtooth').note(50+12).decay(0.5).sustain(0.7).release(2).gain(0.25).out();
-beat(.25)::sound('sawtooth').note([50,57,62].pick() + [12, 24, 0].beat(2))
- .cutoff(5000).sustain(0.5).release(0.1).gain(0.25).out()
+let smooth = (sound) => {
+ return sound.cutoff(r(100,500))
+ .lpadsr(usaw(1/8) * 8, 0.05, .125, 0, 0)
+ .gain(r(0.25, 0.4)).adsr(0, r(.2,.4), r(0,0.5), 0)
+ .room(0.9).size(2).o(2).vib(r(2,8)).vibmod(0.125)
+}
+beat(.25)::smooth(sound('sawtooth').note([50,57,55,60].beat(1))).out();
+beat(.25)::smooth(sound('sawtooth').note([50,57,55,60].add(12).beat(1.5))).out();
`,
true
)};
@@ -182,17 +183,17 @@ There are some basic controls over the playback of each sample. This allows you
| Method | Alias | Description |
|---------|-------|--------------------------------------------------------|
-| n | | Select a sample in the current folder (from 0 to infinity) |
-| begin | | Beginning of the sample playback (between 0 and 1) |
-| end | | End of the sample (between 0 and 1) |
-| loopBegin | | Beginning of the loop section (between 0 and 1) |
-| loopEnd | | End of the loop section (between 0 and 1) |
-| loop | | Whether to loop or not the audio sample |
-| stretch | | Stretches the audio playback rate of a sample over n beats |
-| speed | | Playback speed (2 = twice as fast) |
-| cut | | Set with 0 or 1. Will cut the sample as soon as another sample is played on the same bus |
-| clip | | Multiply the duration of the sample with the given number |
-| pan | | Stereo position of the audio playback (0 = left, 1 = right)|
+| n | | Select a sample in the current folder (from 0 to infinity) |
+| begin | | Beginning of the sample playback (between 0 and 1) |
+| end | | End of the sample (between 0 and 1) |
+| loopBegin | | Beginning of the loop section (between 0 and 1) |
+| loopEnd | | End of the loop section (between 0 and 1) |
+| loop | | Whether to loop or not the audio sample |
+| stretch | | Stretches the audio playback rate of a sample over n beats |
+| speed | | Playback speed (2 = twice as fast) |
+| cut | | Set with 0 or 1. Will cut the sample as soon as another sample is played on the same bus |
+| clip | | Multiply the duration of the sample with the given number |
+| pan | | Stereo position of the audio playback (0 = left, 1 = right)|
${makeExample(
"Complex sampling duties",
@@ -224,13 +225,13 @@ There are three basic filters: a _lowpass_, _highpass_ and _bandpass_ filters wi
| Method | Alias | Description |
|------------|-------|-----------------------------------------|
-| cutoff | lpf | Cutoff frequency of the lowpass filter |
-| resonance | lpq | Resonance of the lowpass filter |
-| hcutoff | hpf | Cutoff frequency of the highpass filter |
-| hresonance | hpq | Resonance of the highpass filter |
-| bandf | bpf | Cutoff frequency of the bandpass filter |
-| bandq | bpq | Resonance of the bandpass filter |
-| vowel | | Formant filter with (vocal quality) |
+| cutoff | lpf | Cutoff frequency of the lowpass filter |
+| resonance | lpq | Resonance of the lowpass filter |
+| hcutoff | hpf | Cutoff frequency of the highpass filter |
+| hresonance | hpq | Resonance of the highpass filter |
+| bandf | bpf | Cutoff frequency of the bandpass filter |
+| bandq | bpq | Resonance of the bandpass filter |
+| vowel | | Formant filter with (vocal quality) |
${makeExample(
"Filter sweep using a low frequency oscillator",
@@ -249,8 +250,8 @@ A basic reverberator that you can use to give some depth to your sounds. This si
| Method | Alias | Description |
|------------|-------|---------------------------------|
-| room | | The more, the bigger the reverb (between 0 and 1.|
-| size | | Reverberation amount |
+| room | | The more, the bigger the reverb (between 0 and 1.|
+| size | | Reverberation amount |
${makeExample(
"Clapping in the cavern",
@@ -267,9 +268,9 @@ A good sounding delay unit that can go into feedback territory. Use it without m
| Method | Alias | Description |
|------------|-----------|---------------------------------|
-| delay | | Delay _wet/dry_ (between 0 and 1) |
-| delaytime | delayt | Delay time (in milliseconds) |
-| delayfeedback| delayfb | Delay feedback (between 0 and 1) |
+| delay | | Delay _wet/dry_ (between 0 and 1) |
+| delaytime | delayt | Delay time (in milliseconds) |
+| delayfeedback | delayfb | Delay feedback (between 0 and 1) |
${makeExample(
"Who doesn't like delay?",
@@ -285,9 +286,9 @@ beat(1)::snd('kick').out()
| Method | Alias | Description |
|------------|-----------|---------------------------------|
-| coarse | | Artificial sample-rate lowering |
-| crush | | bitcrushing. 1 is extreme, the more you go up, the less it takes effect. |
-| shape | | Waveshaping distortion (between 0 and 1) |
+| coarse | | Artificial sample-rate lowering |
+| crush | | bitcrushing. 1 is extreme, the more you go up, the less it takes effect. |
+| shape | | Waveshaping distortion (between 0 and 1) |
${makeExample(
diff --git a/src/documentation/introduction.ts b/src/documentation/introduction.ts
index 28a48c5..ca1e847 100644
--- a/src/documentation/introduction.ts
+++ b/src/documentation/introduction.ts
@@ -12,43 +12,44 @@ Welcome to the Topos documentation. These pages are offering you an introduction
)}. Press again to make the documentation disappear. All your contributions are welcome!
${makeExample(
- "Welcome! Eval to get started",
- examples[Math.floor(Math.random() * examples.length)],
- true
-)}
+ "Welcome! Eval to get started",
+ examples[Math.floor(Math.random() * examples.length)],
+ true
+ )}
## What is Topos?
Topos is an _algorithmic_ sequencer. Topos uses small algorithms to represent musical sequences and processes. These can be written in just a few lines of code. Topos is made to be _live-coded_. The _live coder_ strives for the constant interaction with algorithms and sound during a musical performance. Topos is aiming to be a digital playground for live algorithmic music.
${makeExample(
- "Small algorithms for direct musical expression",
- `
+ "Small algorithms for direct musical expression",
+ `
beat(1) :: sound(['kick', 'hat', 'snare', 'hat'].beat(1)).out()
beat(.5) :: sound('jvbass').note(35 + [0,12].beat()).out()
-beat([0.5, 0.25, 1, 2].beat(1)) :: sound('east')
- .room(.5).size(0.5).n(irand(1,5)).out()`,
- false
-)}
+beat([0.5, 0.25].beat(1)) :: sound('east')
+ .room(.9).speed(flip(4) ? 1 : 0.95).size(0.9).o(2).n($(1)).out()`,
+ false
+ )}
${makeExample(
- "Computer music should be immediate and intuitive",
- `beat(.5)::snd('sine')
+ "Computer music should be immediate and intuitive",
+ `beat(.5)::snd('sine')
.delay(0.5).delayt(0.25).delayfb(0.7)
.room(0.8).size(0.8)
.freq(mouseX()).out()`,
- false
-)}
+ false
+ )}
${makeExample(
- "Making the web less dreadful, one beep at at time",
- `
-beat(.5) :: sound('sid').n($(2)).out()
+ "Making the web less dreadful, one beep at at time",
+ `
+beat(.5) :: sound('sid').n($(2))
+ .room(1).speed([1,2].pick()).out()
beat(.25) :: sound('sid').note(
[34, 36, 41].beat(.25) + [[0,-24].pick(),12].beat())
.room(0.9).size(0.9).n(4).out()`,
- false
-)}
+ false
+ )}
Topos is deeply inspired by the [Monome Teletype](https://monome.org/). The Teletype is/was an open source hardware module for Eurorack synthesizers. While the Teletype was initially born as an hardware module, Topos aims to be a web-browser based software sequencer from the same family! It is a sequencer, a scriptable interface, a companion for algorithmic music-making. Topos wishes to fullfill the same goal than the Teletype, keeping the same spirit alive on the web. It is free, open-source, and made to be shared and used by everyone.
diff --git a/src/main.ts b/src/main.ts
index 119b09b..1f3f7e8 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -32,6 +32,21 @@ import showdown from "showdown";
showdown.setFlavor("github");
import showdownHighlight from "showdown-highlight";
import { makeStringExtensions } from "./StringExtensions";
+
+
+// Broadcast that you're opening a page.
+localStorage.openpages = Date.now();
+window.addEventListener('storage', function(e) {
+ if (e.key == "openpages") {
+ // Listen if anybody else is opening the same page!
+ localStorage.page_available = Date.now();
+ }
+ if (e.key == "page_available") {
+ document.getElementById("all")!.classList.add("invisible")
+ alert("Topos is already opened in another tab. Close this tab now to prevent data loss.");
+ }
+}, false);
+
const classMap = {
h1: "text-white lg:text-4xl text-xl lg:ml-4 lg:mx-4 mx-2 lg:my-4 my-2 lg:mb-4 mb-4 bg-neutral-900 rounded-lg py-2 px-2",
h2: "text-white lg:text-3xl text-xl lg:ml-4 lg:mx-4 mx-2 lg:my-4 my-2 lg:mb-4 mb-4 bg-neutral-900 rounded-lg py-2 px-2",
@@ -1160,7 +1175,7 @@ export class Editor {
}
}
-const app = new Editor();
+let app = new Editor();
window.addEventListener("beforeunload", () => {
// @ts-ignore
@@ -1172,3 +1187,4 @@ window.addEventListener("beforeunload", () => {
app.clock.stop();
return null;
});
+