forked from abh1nash/ace-daw
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: wire aux sends to audio engine with pre/post fader toggle #1039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ChuxiJ
wants to merge
1
commit into
main
Choose a base branch
from
feat/issue-984-pre-post-fader-sends
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Mixer & Signal Routing — Gap Analysis vs openDAW | ||
|
|
||
| **Date:** 2026-03-27 | ||
| **Theme:** Mixer & Signal Routing is the largest depth gap (~35% complete vs pro DAW) | ||
| **Reference:** openDAW `packages/studio/core/src/Mixer.ts`, `lib-dsp/src/graph.ts` | ||
|
|
||
| ## Executive Summary | ||
|
|
||
| ACE-Step-DAW has a functional mixer with volume/pan/EQ/compressor/reverb per channel, 2 send slots, and basic group tracks. However, it lacks the **routing depth** that defines a professional mixer: pre/post fader sends, group bus processing, topological routing validation, send automation, and dynamic slot limits. | ||
|
|
||
| openDAW implements a two-layer solo system (UI + audio thread), topological sort with loop detection, pre/post aux sends with ramped gains, and a full graph-based routing model. These patterns are well-documented and adaptable to our React + Zustand + Tone.js stack. | ||
|
|
||
| ## Current State (ACE-Step-DAW) | ||
|
|
||
| ### What Works | ||
| - Channel strip: volume (0-1), pan (-1 to +1), 3-band fixed EQ, compressor, convolver reverb | ||
| - Sends: `Send { returnTrackId, amount }` — 2 slots max, post-fader only (implicit) | ||
| - Return tracks: `ReturnTrack { id, name, effects[], volume, pan }` | ||
| - Group tracks: `isGroup` flag, `parentTrackId` for hierarchy, mute/solo propagation to children | ||
| - Solo logic: flat — if any track soloed, all others with `soloActive=true` get muted | ||
| - Audio routing: child tracks re-routed to group's `inputGain` via `rerouteOutput()` | ||
|
|
||
| ### What's Missing (Priority Order) | ||
|
|
||
| | # | Gap | Impact | Effort | | ||
| |---|-----|--------|--------| | ||
| | 1 | Pre/post fader sends | Blocks headphone mix, parallel compression | M | | ||
| | 2 | Group bus processing (effects on groups) | Blocks drum bus compression, submix FX | M | | ||
| | 3 | Dynamic send/insert slots | Blocks complex routing (3+ aux buses) | S | | ||
| | 4 | Routing validation (topo sort) | Risk of feedback loops, undefined behavior | M | | ||
| | 5 | Send automation | Can't automate reverb sends over time | S | | ||
| | 6 | Virtual solo (routing-aware) | Solo'd group doesn't bring input tracks | S | | ||
| | 7 | Signal flow visualization | Users can't see routing topology | L | | ||
| | 8 | Return track metering | Can't monitor what feeds a return | S | | ||
| | 9 | Sidechain routing UI | Param exists but no picker | S | | ||
| | 10 | Mid/Side processing | Advanced mixing technique unavailable | L | | ||
|
|
||
| ## openDAW Reference Patterns | ||
|
|
||
| ### 1. Pre/Post Sends | ||
| ```typescript | ||
| // openDAW: AudioSendRouting enum | ||
| enum AudioSendRouting { Pre, Post } | ||
|
|
||
| // AuxSendProcessor applies gain + pan, taps pre or post fader | ||
| // Pre: tapped before channel volume node | ||
| // Post: tapped after channel volume node (default) | ||
| ``` | ||
|
|
||
| **Our adaptation:** Add `preFader?: boolean` to `Send` interface. In `TrackNode`, create a send tap point before `volumeGain` (pre) or after `volumeGain` (post). Wire send gain nodes accordingly. | ||
|
|
||
| ### 2. Virtual Solo (Routing-Aware) | ||
| ```typescript | ||
| // openDAW: Two-pass algorithm | ||
| // Pass 1: Trace upstream from solo'd channels → mark as virtualSolo | ||
| // Pass 2: Trace downstream from solo'd channels → mark bus outputs as virtualSolo | ||
| // Result: Solo a group → its children stay audible | ||
| ``` | ||
|
|
||
| **Our adaptation:** Replace flat `soloActive` boolean with graph traversal: | ||
| ```typescript | ||
| function computeAudibleTracks(tracks: Track[]): Set<string> { | ||
| const soloed = tracks.filter(t => t.soloed); | ||
| if (soloed.length === 0) return new Set(tracks.filter(t => !t.muted).map(t => t.id)); | ||
|
|
||
| const audible = new Set(soloed.map(t => t.id)); | ||
| // Upstream: if group soloed, add all children | ||
| for (const t of soloed) { | ||
| if (t.isGroup) addChildren(t.id, tracks, audible); | ||
| } | ||
| // Downstream: if child soloed, add parent group chain | ||
| for (const t of soloed) { | ||
| let parent = t.parentTrackId; | ||
| while (parent) { | ||
| audible.add(parent); | ||
| parent = tracks.find(p => p.id === parent)?.parentTrackId; | ||
| } | ||
| } | ||
| return audible; | ||
| } | ||
| ``` | ||
|
|
||
| ### 3. Topological Sort for Routing | ||
| ```typescript | ||
| // openDAW: TopologicalSort<V> class | ||
| // - Builds successor map from edges | ||
| // - Computes transitive closure (iterative fixed-point) | ||
| // - DFS with loop detection | ||
| // - Output: sorted order + hasLoops flag | ||
| ``` | ||
|
|
||
| **Our adaptation:** Before connecting Web Audio nodes, build a directed graph of track→return→master routing and sort topologically. Reject routing changes that create cycles. | ||
|
|
||
| ### 4. Group Bus Processing | ||
| openDAW treats groups as full audio units with their own effect chain, sends, and volume/pan. Our groups are organizational only — audio routes through `inputGain` but bypasses effects. | ||
|
|
||
| **Our adaptation:** When `isGroup`, the TrackNode should have its own effect chain that processes the summed input of all children before routing to master/parent. | ||
|
|
||
| ## Proposed Issue Breakdown | ||
|
|
||
| 1. **feat: add pre/post fader toggle to sends** — Extend Send interface, wire tap points in TrackNode | ||
| 2. **feat: enable effects processing on group tracks** — Allow effect chain on group TrackNodes | ||
| 3. **feat: remove hardcoded send/insert slot limits** — Dynamic arrays instead of MAX_SEND_SLOTS=2 | ||
| 4. **feat: add routing validation with topological sort** — Prevent feedback loops in send routing | ||
| 5. **feat: add send amount to automation parameters** — Extend AutomationParameter for sends | ||
|
|
||
| ## Files to Modify | ||
|
|
||
| - `src/types/project.ts` — Send interface, Track interface | ||
| - `src/engine/TrackNode.ts` — Pre/post tap points, group effect chain | ||
| - `src/engine/AudioEngine.ts` — Solo algorithm, routing validation | ||
| - `src/store/projectStore.ts` — Store actions for new send fields, group effects | ||
| - `src/components/mixer/MixerPanel.tsx` — UI for pre/post toggle, dynamic slots | ||
| - `src/utils/effectAutomation.ts` — Send automation parameter descriptors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PRE/PST toggle click handler uses
amount || 0.5, which will unexpectedly jump a send from 0 to 0.5 just by toggling the tap point (audible surprise). If sends are intentionally removed at amount=0, consider disabling the toggle whenamount === 0, or changing the store model to persistpreFadereven when amount is 0 so the toggle doesn’t need to mutate the amount.