Nodes/KIE.ai Nodes Next/Generate MIDI from Audio
ComfyUI Node

Generate MIDI from Audio

It doesn't take audio, it takes a task ID

By felipederosilva·Created about a month ago·Updated about 21 hours ago· 3
Generate MIDI from Audio
    • audio
    • url
    • all_urls_json
    • task_id
    • raw_json
    • credits_consumed
    • credits_left
    ◄task_id5c79****be8e►
    ◄audio_id8ca376e7-******-08aaf2c6dd27►
    ◄timeout_seconds1200►
    ◄callback_url►

    The name is a lie in the way that matters: you don't connect an audio file to this one. It takes a task ID from a completed vocal separation job and returns MIDI transcription of the separated stems. Read that twice before you wire it up, because it inverts the usual shape of every other node in this pack.

    Why it works this way

    KIE's stem-separation endpoint splits a track into vocals and instrumental and hands you back task metadata, including a list of the separated tracks with their own IDs. This endpoint picks up from there: give it the separation task ID, and optionally the ID of one specific stem, and it transcribes that audio into MIDI. Because the source audio already lives on KIE's side, there's nothing to upload and no audio socket on the card.

    That's the mechanism: it's a second-stage call keyed off a prior job, not an audio-processing node. If you want the MIDI of a specific stem, you get that stem's ID from the separation details response - KIE documents it as the id field inside the originData array.

    Inputs

    task_id (required) - the separation task ID from a completed Vocal & Instrument Stem Separation run. That's your real input, and it's a string you paste or wire from the separation node's task_id output. The default text on the field is a masked placeholder, not a real ID.

    audio_id (optional) - which separated track to transcribe. Leave it empty and the docs say MIDI is generated from all separated tracks; fill it in and you target one stem. Useful when you only care about the bassline or the melody.

    timeout_seconds - 1200 default, 30–7200. Transcription jobs are not instant.

    callback_url - leave empty for normal ComfyUI use.

    Outputs

    audio, url, all_urls_json, task_id, raw_json, credits_consumed, credits_left.

    And here's the honest note: the pack's media socket type is derived from the API family this operation belongs to, and this one sits in the Audio group - so you get an audio socket. What the endpoint returns is a MIDI file, which is not an audio codec at all. Don't build your workflow around that socket carrying a playable waveform; url and all_urls_json are the outputs that reliably tell you what the API produced, and a MIDI file is something you open in a DAW or feed to a local renderer. task_id is the job handle, raw_json the full response, and the two credit floats plus the on-node receipt cover billing.

    Install

    ComfyUI Manager (search the pack title), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
    

    Restart. Requirements: requests, Pillow, numpy, PyYAML. Nothing local, no GPU work, always metered.

    Key: Settings → KIE.ai Nodes Next → Connection → Paste / replace KIE.ai API key, validated before it replaces a saved key, with a masked fingerprint and CONNECTED afterwards. Servers can skip the UI with KIE_API_KEY, which outranks the saved key.

    Gotchas

    You must run the separation first. This node has no path to audio on its own. A workflow with this node and no upstream separation job will just fail.

    A stale task ID fails quietly. IDs come from a specific completed job; copying one from an old session won't resolve.

    Don't assume the media socket plays. See above - trust url.

    Fields come from the provider. The pack builds its node library from KIE's API documentation at startup and re-checks about every 24 hours, so if this endpoint gains an option, you'll see it after a ComfyUI restart.

    CategoryKIE Next/Audio/Suno

    Inputs (4)

    NameTypeDefaultDescription
    task_idSTRING5c79****be8eTask ID from a completed vocal separation. This should be the task_id returned from the Vocal & Instrument Stem Separation endpoint.
    audio_idoptSTRING8ca376e7-******-08aaf2c6dd27Optional. Specifies which separated audio track to generate MIDI from. This audio_id can be obtained from the `originData` array in the Get Vocal Separation Details endpoint response. Each item in `originData` contains an `id` field that can be used here. If not provided, MIDI will be generated from all separated tracks.
    timeout_secondsoptINT120030–7200—
    callback_urloptSTRINGOptional KIE callback URL. Leave empty for normal ComfyUI use.

    Outputs (7)

    NameTypeDescription
    audioAUDIO—
    urlSTRING—
    all_urls_jsonSTRING—
    task_idSTRING—
    raw_jsonSTRING—
    credits_consumedFLOAT—
    credits_leftFLOAT—