This package bundles a CLI
to allow basic usage of the Music.AI API.
Here's how you can easily process a folder containing audio files against the music-ai/isolate-drums
workflow:
export MUSIC_AI_API_KEY=your-api-key
musicai process folder music-ai/isolate-drums ./audio ./stems
npm i @music.ai/cli -g
High-level method to process a single local file. Behind the scenes, this will: create a new job; wait for its completion; download the results to your local folder; and delete the job from the developer platform.
In addition to these steps, the result will also be saved in a file named workflow.result.json
. This file will contain all the outputs in JSON format. If an output is a file, the relative path to the downloaded file will be written in the JSON. If the output is not a file, the actual value will be written instead.
musicai process file <workflow> <fileLocation> <outputFolder>
If the workflows has two outputs, vocals in WAVE format and bpm, two files will be created at the output folder: vocals.wav
and workflow.result.json
.
// workflow.result.json
{
"vocals": "./vocals.wav",
"bpm": "64"
}
Similar to the previous method, but will process all files in the folder:
musicai process folder <workflow> <inputFolder> <outputFolder> [--watch]
You can use the --watch
option to continuously process new files added to the inputFolder
.
musicai job add <name> <workflow> <inputFile>
musicai job delete <jobId>
musicai job info <jobId>
musicai job list <jobId>