I wanted to know if it was possible to fine-tune the options of the magenta MusicVAE or MusicRNN model to produce melodies of a specific key.
Looked through the code and saw a MusicVAESpec object and a MusicVAEControlArgs object to help with the fine-tuning but I just don't know how to configure it.
Thanks in advance for the help.
Find below the code for the function I am working on. I have initialized a MusicVAESpec object and passed it as a parameter when initializing the MusicVAE model. Also have a MUsicVAEControlArgs object that is passed to model.sample() but I get a "Error: Error in matMul: inner shapes (1382) and (1370) of Tensors with shapes 1,1382 and 1370,4096 and transposeA=false and transposeB=false must match."
ยง
async generateMelody() {
this.isLoading = true;
const VAEspec = {
"type": "MusicVAE",
"dataConverter": {
"type": "MelodyConverter",
"args": {
"numSteps": 16,
"minPitch": 21,
"maxPitch": 108,
"ignorePolyphony": true,
}
},
"useBooleanDecoder": false,
"conditionOnKey": true
}
const model = new mm.MusicVAE('https://storage.googleapis.com/magentadata/js/checkpoints/music_vae/mel_4bar_med_lokl_q2', VAEspec);
const mrnnModel = new mm.MusicRNN('https://storage.googleapis.com/magentadata/js/checkpoints/music_rnn/melody_rnn');
await model.initialize()
await mrnnModel.initialize()
const temperature = Math.random() * 0.2 + 0.6;
const controlArgs = {
key: 60,
};
const samples = await model.sample(1, temperature, controlArgs);
console.log(samples)
this.isLoading = false;
}
},
}