Public
Edited
Nov 25, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
midi(1, "C4")
Insert cell
Insert cell
Insert cell
Insert cell
Tonal.Scale
Insert cell
Tonal.Scale.names()
Insert cell
Insert cell
Tonal.Scale.get(`C4 ${exampleScale}`)
Insert cell
Tonal.Scale.scaleChords(exampleScale)
Insert cell
Tonal.Scale.rangeOf(`C4 ${exampleScale}`)("C4", "C5")
Insert cell
Insert cell
Tonal.Chord
Insert cell
Tonal.ChordType.names()
Insert cell
Tonal.ChordType.symbols()
Insert cell
Insert cell
Tonal.Chord.get(chord)
Insert cell
Tonal.Chord.getChord(chord, "C4")
Insert cell
Insert cell
Tonal.Key.majorKey("C4")
Insert cell
Tonal.Key.minorKey("C4")
Insert cell
Insert cell
Tonal.Mode
Insert cell
Insert cell
Tonal.Mode.notes(mode, "C4")
Insert cell
Tonal.Mode.triads(mode, "C4")
Insert cell
Tonal.Mode.seventhChords(mode, "C4")
Insert cell
Insert cell
Insert cell
{
const Generator = Object.getPrototypeOf(function* () {});
Generator.prototype.map = function (transform) {
return Generators.map(this, transform);
};
Generator.prototype.filter = function (test) {
return Generators.filter(this, test);
};
Generator.prototype.valueAt = function (i) {
return Generators.valueAt(this, i);
};
Generator.prototype.take = function (count) {
const acc = [];
let result;
while (!(result = this.next()).done && count-- > 0) {
acc.push(result.value);
}
return acc;
};

Array.prototype.rotate = function (offset) {
const n = offset % this.length;
return this.slice(n, this.length).concat(this.slice(0, n));
};
}
Insert cell
Insert cell
TotalSerialism = require("total-serialism@1.16.0/build/ts.es5.js")
Insert cell
Insert cell
Insert cell
Insert cell
Algo = TotalSerialism.Algorithmic
Insert cell
function* rule(number, width = 32) {
const ca = new Algo.Automaton();
// feed with 32 randomly generated values 0-1
ca.feed(Rand.coin(width));
// set the rule with a decimal representation
ca.rule(number);
// generate the next generation and store in array

while (true) {
yield ca.next();
}
}
Insert cell
Insert cell
Insert cell
rules = rule(ruleOptions.number, ruleOptions.width).take(24)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Rand = TotalSerialism.Stochastic
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Mod = TotalSerialism.Transform
Insert cell
Insert cell
Stat = TotalSerialism.Statistic
Insert cell
Insert cell
Util = TotalSerialism.Utility
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
clock(clockOptions.mod, clockOptions.rate, clockOptions.skew).take(8)
Insert cell
Insert cell
Insert cell
Insert cell
delay(delayOptions.mod, delayOptions.rate, delayOptions.skew).take(24)
Insert cell
Insert cell
function* random(min = 0, max = 7) {
// min and max included
while (true) {
yield _.random(min, max);
}
}
Insert cell
random(1, 7).take(24)
Insert cell
Insert cell
midi = (
channel,
notes,
velocity = undefined,
length = trackerOptions.frameTimeMs
) => {
if (!notes) {
return;
}

output.playNote(notes, channel, {
// velocity,
duration: length
});

return { c: channel, n: notes, v: velocity, d: length };
}
Insert cell
midi(10, "A2")
Insert cell
Insert cell
Insert cell
scale = Tonal.Scale.get(`C4 ${scaleName}`)
Insert cell
scaleChords = Tonal.Scale.scaleChords(scaleName).map((chord) =>
Tonal.Chord.get(chord)
)
Insert cell
rootedScaleChords = scaleChords.map((chord) =>
Tonal.Chord.getChord(chord.symbol, scale.tonic)
)
Insert cell
rootedScaleChordsNotes = rootedScaleChords.map((chord) => chord.notes)
Insert cell
// rootedScaleChords.map((chord) => midi(0, chord))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
faStyle({ solid: true })
Insert cell
Insert cell
Insert cell
track1 = rootedScaleChordsNotes
Insert cell
track2 = []
Insert cell
// track3 = TotalSerialism.Algorithmic.euclid(16, 9).map((v) =>
// v ? "B2" : undefined
// )
Insert cell
track4 = []
Insert cell
track5 = []
Insert cell
// track10 = TotalSerialism.Algorithmic.euclid(16, 2).map((v) =>
// v ? "A2" : undefined
// )
Insert cell
allTracks = _.zip(track1, track2, [], track4, [], [], [], [], [], [], [])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vf = new vexflow.Factory({
renderer: { elementId: "vexflow-output", width: 500, height: 200 }
})
Insert cell
score = vf.EasyScore()
Insert cell
system = vf.System()
Insert cell
{
go;

system
.addStave({
voices: [
score.voice(score.notes("C#5/q, B4, A4, G#4", { stem: "up" })),
score.voice(score.notes("C#4/h, C#4", { stem: "down" }))
]
})
.addClef("treble")
.addTimeSignature("4/4");

vf.draw();
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more