Fix Activity 3 bassline sourced from wrong part#155
Merged
hcientist merged 9 commits intoLab-Lab-Lab:mainfrom Apr 1, 2026
Merged
Fix Activity 3 bassline sourced from wrong part#155hcientist merged 9 commits intoLab-Lab-Lab:mainfrom
hcientist merged 9 commits intoLab-Lab-Lab:mainfrom
Conversation
The previous fix used preferredSample which resolves to the Melody part's sample_audio (the student's assignment). The bassline needs to come from the Bassline assignment for the same piece, found via activities Redux state. Also fixes race condition where assignment being null on first render caused the loading gate to pass through, mounting DAWProvider with empty tracks.
Replace the initialTracks pre-population approach (which had timing issues with useState only reading on first mount) with sample takes injected into the Import Takes modal. The bassline appears as a named take that students import themselves, matching the activity instructions flow.
Edge-drag on clips now behaves like standard DAWs (trim, not stretch): - resizeL: moves the in-point into the buffer, can't reveal past offset 0 - resizeR: extends the out-point, clamped to the source audio buffer length - Clips store sourceDuration (total audio buffer length) for bounds checking - sourceDuration set on all clip creation paths: import, recording, auto-init - Split clips inherit sourceDuration from the parent via spread
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
/media/URLs (separate backend change needed)Changes
Bassline loading for Activity 3
The bassline sample was never appearing in the multitrack editor. Root causes:
preferredSamplewhich is the Melody part's sample, not the BasslineinitialTrackspre-population (which fightsuseStateonly reading on first mount), the bassline is now injected as a named sample take. Students see it in the "Import Takes" modal and import it themselvesAudio.loadedmetadatafor takes that report 0:00Activity operation logging (Activities 1-2)
logOperationcalls inCustomTimeline.jsx(handleCut,handleSplice, undo) are nowawaited sequentially to prevent concurrent backend requests that causeddatabase is locked(SQLite) or race conditions (stalestep_completionsoverwrites)Multitrack playback cursor
AudioContextwas suspended (browsers block auto-created contexts). AddedaudioContext.resume()in the transport'splay()method — the Play button click is a valid user gestureError diagnostics
assertResponseinapi.jsnow includes the response body in thrown errors (e.g.400: Bad Request — {"error":"database is locked"}) instead of just the status textFiles changed
pages/.../activity/[step].jssampleTakesfrom Bassline assignment, pass to DAWcomponents/audio/DAW/index.jssampleTakespropcomponents/audio/DAW/Multitrack/MultitrackWithTakes.jscomponents/audio/DAW/Multitrack/TakesImportModal.jscomponents/audio/DAW/CustomWaveform/CustomTimeline.jsxcomponents/audio/DAW/Multitrack/AudioEngine.jsapi.js