Skip to content

feat: advanced split — per-instrument stems + MIDI via /api/advanced_split - #3

Open
francialisomlimoeiro wants to merge 1 commit into
ShowSnowBlood:mainfrom
francialisomlimoeiro:advanced-split
Open

feat: advanced split — per-instrument stems + MIDI via /api/advanced_split#3
francialisomlimoeiro wants to merge 1 commit into
ShowSnowBlood:mainfrom
francialisomlimoeiro:advanced-split

Conversation

@francialisomlimoeiro

Copy link
Copy Markdown

Adds POST /api/advanced_split — Suno Studio "Extract Stems and MIDI" (Advanced split tab).

What it does

  • Per-instrument stem extraction or removal — instrument names match the browser dropdown exactly (e.g. "Drum Kit", "Lead Vocal")
  • MIDI note-events per instrument via the existing GET /api/gen/{id}/midi

Request contract

{
  "song_id": "<source clip id>",
  "instruments": ["Drum Kit", "Lead Vocal"],
  "mode": "extract",
  "include_midi": true
}

mode: "extract" (isolate) or "remove" (karaoke). include_midi also requests the MIDI batch and returns note-events.

Implementation notes

  • Backed by the v2-web gen_stem task: one POST /api/generate/v2-web/ per instrument, stem_type_id=91 (constant for advanced mode; the instrument is carried by stem_type_group_name/stem_name), source clip in continue_clip_id
  • Desktop-browser fingerprint headers on all v2-web/feed/midi calls (the Android client default headers are rejected upstream with permission_denied)
  • metadata.user_tier sourced from GET /api/billing/info/, device-id header included
  • Captcha token obtained through the existing getCaptcha() flow and passed in the payload when upstream demands it
  • Audio stems polled with GET /api/feed/?ids= until complete; MIDI clip keeps polling on 400 Clip must be complete until it resolves within the deadline, then note-events are fetched from the midi endpoint

Link-first: all existing routes are untouched; this is purely additive (new endpoint + supporting SunoApi methods, docs + swagger entry).

Verified against a live account: 2 instruments in one call, 8 clips complete (extract/remove x audio/MIDI), audio downloadable from CDN, MIDI note-events non-empty.

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.

1 participant