Skip to content

Mini mix on effect pages: a layered track, each layer through the effect or past it - #3

Open
Que2039 wants to merge 3 commits into
mainfrom
cursor/layered-track-player-145c
Open

Que2039 wants to merge 3 commits into
mainfrom
cursor/layered-track-player-145c

Conversation

@Que2039

@Que2039 Que2039 commented Dec 2, 2026

Copy link
Copy Markdown

Workstream 2 of the UX plan ("Loops and the multi-layer mini mix"), review issue 4: effects had no before/after.

Effect pages no longer play one loop at a time, always fully through the effect. They now play a whole track of 7 layers in sync. Each layer has a strip: its name mutes it, FX sends it through the effect, S solos it, and a slider sets its level. Switching a single layer through and back is the before/after.

Placeholder. The track ("Groove in A minor") is made of the loops scripts/samples.mjs already synthesizes: drums, bass, keys, pad, pluck, lead voice and spoken vocal. They were always parts of one 4-bar, 120 BPM piece. A yellow "Placeholder" badge shows in the player. Real community-track stems replace it later; the options doc covers how to render them per mixer channel from Audiotool projects. The per-layer levels are first guesses and need tuning by ear.

Changes

  • player/layered-track.js (new): the audio engine. All layers start at one shared moment. Every buffer is cut or padded to exactly the track's length, so AAC padding can't make the layers drift. Layers that load late join in phase. Each layer has level, mute, solo and a through/dry send, with 15 ms ramps so nothing clicks. The effect gets one summed input, so it runs only once. setThroughDest(null) plays everything dry (for an effect On/Off switch, or for instruments).
  • player/tracks.js (new): the track definition.
  • player/mini-mix.js (new): the UI, self-contained. main.js creates it and puts it in the existing strip above the device, in place of the loop chips. The single-loop code is gone.
  • Defaults come from each effect's existing loops list. The first loop goes through; the rest of the list plus drums, bass and keys play dry beside it; the other layers start muted. "mix" means drums + bass + keys.
  • Dry layers get the same 0.55 headroom gain as the effect input, so pressing FX changes only the effect, not the layer's level.
  • Copy: "Play loop" is now "Play track", and the tours' "Pick a loop above the device and press Play" now reads "Press Play track above the device".
  • npm test: 10 unit tests for the engine (Node's built-in runner with a fake audio context). They cover defaults, routing, solo and mute, exact loop length and in-phase joining.
  • site/ is regenerated with a pages-only build. Only the cache hashes, the player strings and the player bundle change.

Not changed: "Open in Audiotool" and the templates still put each effect's three loops into the Studio project.

Coordination with workstream 1 (control bar below the device). That PR didn't exist when this was built, so the UI is isolated. When both merge, move loopCtl (Play plus mix.el) into the new bar, and wire the effect On/Off switch to mix.setThroughDest(on ? loopIn : null), or keep bypassing at loopIn. Either works.

How it was verified. npm test passes. The site build is node scripts/build.mjs --pages --no-share-images with A_PLUGINS_DATE=2026-11-30. native-nxs isn't available here, so I applied PR #2's build fallback temporarily and didn't commit it. With that fallback, unmodified main rebuilds byte for byte, so the regenerated diff contains only this PR's changes. I didn't click through it in a browser.

Human checklist

  • On an effect page (Tape /tape/, a reverb like Quasar /quasar/, Vocoder /vocoder/), press Play track. All audible layers start together and stay in step over several loops.
  • On Tape, drums go through by default (outlined strip, lit FX). Toggle FX on drums: the saturation comes and goes, and the level stays about the same.
  • On Vocoder, only the spoken vocal goes through.
  • Mute (click the layer name) and solo (S) behave as in a mixer. Muted or non-soloed strips are dimmed.
  • Level sliders change smoothly, with no clicks. The overall level is comparable to the old loop, and nothing clips with all 7 layers up.
  • Moving to another effect via Next or a related card keeps the track playing and applies that effect's defaults. Going to an instrument stops the track.
  • First play on a slow connection (DevTools "Fast 3G"): the first layers start as soon as they arrive, and later ones join in time.
  • Phone width (390 px): the strips wrap into a grid, controls stay tappable, and the device stays visible.
  • Safari / iOS: Play starts audio on the first tap.
Open in Web Open in Cursor 

cursoragent and others added 3 commits December 2, 2026 16:37
…and through-the-effect send; tests

Co-authored-by: David Querg <Que2039@users.noreply.github.com>
…o, level, mute) in place of the loop chips; placeholder track from the synthesized loops

Co-authored-by: David Querg <Que2039@users.noreply.github.com>
Co-authored-by: David Querg <Que2039@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants