RATE = 44100,
t = t/RATE,

BPM = 130,	// 130 BPM

BEAT_DIV = 1 / BPM * 60 / 2,
MEASURE_LEN = 13,	// 13/8 time sig

beat_num = Math.floor(t / BEAT_DIV) % MEASURE_LEN,
beat_prog = (t % BEAT_DIV) / BEAT_DIV,

measure_num = Math.floor(t / (MEASURE_LEN * BEAT_DIV)),
measure_t_len = BEAT_DIV * MEASURE_LEN,
measure_prog = (t % measure_t_len) / measure_t_len,

hz = (n) => (
	factor = Math.pow(2, 1/13),	// 13 edo
	169 * Math.pow(factor, n)	// base freq 13^2 Hz
),

note = (n, t) => Math.pow(Math.sin(3.14 * t * hz(n)), 13),	// sin^13 wave
bass = (n, t) => (
	p = 1 / hz(n),
	x = (t % p) / p,
	v = x > .5 ? x : 1 - x,
	2 * Math.pow(v, 13) - 1	// tri^13 wave
),

note_emph = (n) => (
	(n % 3 == 0) ^ (n > 10)
),

note_pick = (seed, p, n) => (
	(seed * Math.pow(n, p)) % 13	// 13 notes
),

macro_pick = (seed, n) => (
	Math.pow(seed + n, 2) % 13	// another 13 notes
),

128 + 127 * 0.5 * (
	macro = macro_pick(1313, measure_num),
	(note(13 + note_pick(131, 2 + (measure_num % 2), beat_num) + macro, t) * Math.min(beat_prog * 1e3, 1 - beat_prog) * (note_emph(beat_num) ? 1 : .6)) +
	(bass(-26 + macro, t) * Math.min(measure_prog * 1e3, 1 - measure_prog))
)
