color-synth

a synth that generates colors instead of sounds
Log | Files | Refs | README

commit 4b416023af95fa7bb2eedc4fd26243fbae884b51
parent 5c9284a6084c232c1c47be8539b15e81f2c2afc2
Author: massi <mdsiboldi@gmail.com>
Date:   Fri, 19 Jul 2024 00:28:03 -0700

simply and demagic-numberify osc calcs

Diffstat:
Msrc/lib/engine.worker.ts | 5++---
Msrc/lib/types.ts | 3---
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/lib/engine.worker.ts b/src/lib/engine.worker.ts @@ -12,7 +12,6 @@ import { ROWS, COLS, getUnit, - LOOP_CYCLES, RANGE, rescale, wrangle, @@ -118,7 +117,7 @@ function vUnit(x: { id: UnitId }): number { const unit: Unit = getUnit(null, config!.units, id); switch (unit.kind) { case 'osc': { - const position = getUnitState(id) / LOOP_CYCLES; + const position = getUnitState(id); const shapeIdx = Math.round( wrangle(v(unit.controls.waveshape), RANGE.signal, unitRange.osc.waveshape) ); @@ -230,7 +229,7 @@ function update() { } else { setUnitState( id, - (position + (coarse * LOOP_CYCLES) / 100 + fine * 10000 + superfine) % LOOP_CYCLES + (position + coarse / COLS + fine / CELLS + superfine / (CELLS * 10_000)) % 1 ); } break; diff --git a/src/lib/types.ts b/src/lib/types.ts @@ -1,9 +1,6 @@ -export const RES = 10_000; -export const INPUT_RANGE = 100; export const ROWS = 100; export const COLS = 100; export const CELLS = ROWS * COLS; -export const LOOP_CYCLES = RES * CELLS; export type WithTarget<E, T> = E & { currentTarget: T }; export type Prettify<T> = { [k in keyof T]: T[k] } & {};