Currently, I am utilizing a method in Tone.js that requires strings as arguments. Is there a way to define the variables at the beginning and then maintain them within their respective quotation marks?
The following is the syntax that functions correctly:
var chain = new Tone.CtrlMarkov({
"D2": "D4",
"D4": ["D2","D3"],
"D3":"D2"
});
This is what I am attempting to achieve (and have experimented with different combinations of using quotes, omitting them, or employing the val1.toString() method:
var val1 = "D2"; //trying using quotes
var val2 = D4; //trying not using quotes
var val3 = D3;
var chain = new Tone.CtrlMarkov({
val1: val2,
val2: [val1,val3],
val3.toString(): val1 //trying toString method
});
Thank you! For further reference, the documentation for the library can be found here and my jsfiddle demonstration is available here.