Skip to content

fix: external audio drop creates sample track instead of Quick Sampler#918

Open
ChuxiJ wants to merge 1 commit intomainfrom
fix/issue-916-external-audio-drop
Open

fix: external audio drop creates sample track instead of Quick Sampler#918
ChuxiJ wants to merge 1 commit intomainfrom
fix/issue-916-external-audio-drop

Conversation

@ChuxiJ
Copy link
Copy Markdown

@ChuxiJ ChuxiJ commented Mar 26, 2026

Summary

  • External audio file drops on the timeline now create a sample track with a visible waveform clip instead of a Quick Sampler (piano roll) track
  • Alt+Drop preserved for users who intentionally want Quick Sampler
  • Fixed in both the main timeline drop zone and empty track slot drop handler

Root Cause

Timeline.tsx called importAudioFileAsNewQuickSampler() for all external audio drops, which creates an invisible piano roll track. Changed to importAudioFile() which creates a proper sample track with waveform rendering.

Test plan

  • Drop a .wav/.mp3 file from Finder onto the empty timeline area → should create a sample track with visible waveform
  • Alt+Drop the same file → should create a Quick Sampler (piano roll) track
  • Drop on an existing sample track lane → should add clip to that track (unchanged behavior)
  • Drop on an empty slot below existing tracks → should create sample track with waveform

Closes #916

🤖 Generated with Claude Code

When dropping an external audio file on the empty timeline area, it was
creating a Quick Sampler (piano roll) track instead of a sample track.
The audio was invisible because Quick Sampler doesn't render waveform
clips on the timeline.

Now defaults to importAudioFile() which creates a proper sample track
with visible waveform. Alt+Drop still creates Quick Sampler for users
who want that workflow.

Fixes both the main timeline drop zone and the empty track slot drop.

Closes #916

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 26, 2026 17:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts timeline drag/drop importing so external audio drops create a visible waveform sample track by default, while preserving Alt+Drop for Quick Sampler creation.

Changes:

  • Timeline empty-area drop now imports audio as a sample track by default (Alt+Drop -> Quick Sampler).
  • Empty track-slot drop handler updated to follow the same default behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (wantsQuickSampler) {
await importAudioFileAsNewQuickSampler(file);
} else {
await importAudioFile(file);
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In EmptyTrackRow's drop handler, the non-Alt path calls importAudioFile(file), but importAudioFile always creates a new sample track at the end and always places the clip at startTime: 0. This ignores the computed startTime (based on the drop X position) and the slotIndex insertion semantics for an empty slot, so the resulting clip/track placement won’t match where the user dropped. Consider creating the new sample track with { order: slotIndex + 1 }, setting its display name, and then importing the file into that track at startTime (e.g., via the existing importAudioToTrack/buffer-to-track path).

Suggested change
await importAudioFile(file);
await importAudioFile(file, {
startTime,
trackOrder: slotIndex + 1,
displayName: file.name,
});

Copilot uses AI. Check for mistakes.
Comment on lines +298 to +306
// Audio files -> sample track (Alt+Drop -> Quick Sampler), MIDI files -> piano roll tracks
const wantsQuickSampler = e.altKey;
const files = e.dataTransfer.files;
if (files.length > 0) {
for (const file of Array.from(files)) {
if (file.type.startsWith('audio/') || /\.(wav|mp3|ogg|flac|aac|m4a|webm)$/i.test(file.name)) {
await importAudioFileAsNewQuickSampler(file);
if (wantsQuickSampler) {
await importAudioFileAsNewQuickSampler(file);
} else {
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drop behavior changed (audio drop => sample track, Alt+Drop => Quick Sampler) in both the main timeline drop zone and the empty-slot drop handler, but there doesn’t appear to be any unit test coverage for these paths. Please add a Timeline drag/drop test (similar to the existing timeline/TrackLane tests) that asserts importAudioFile is called for normal drops and importAudioFileAsNewQuickSampler is called when altKey is true.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

ChuxiJ commented Mar 27, 2026

⚠️ Merge conflict — this PR has conflicts with main after recent refactoring merges (#1046, #1049, #1050, #1052). Needs a rebase to resolve. The fix itself is small (17 additions, 7 deletions in Timeline.tsx) but Timeline.tsx was decomposed in #1049, so the change likely needs to be applied to the new sub-component location.


Generated by Claude Code

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.

fix: external audio file drop on timeline creates Quick Sampler instead of sample track

2 participants