Question on modifying "Strudel object"

Hi all,

I’m quite a newbie in Strudel and Javascript but have good experience in Software Engineering.

Now, I’m using @strudel/web and have a script that looks like this:

document.getElementById('play').addEventListener('click', () => playMelody());
document.getElementById('stop').addEventListener('click', () => stopIt());

function playMelody() {
    var melody = n("<[[2 ~] [2 ~] 2 3] [[3 ~] [3 ~] 3 3]>@8").sound("<sawtooth>").fast(2)
    .scale("d4:minor").attack(.05).hpf("<1000 2000>*12").gain(".4");

    return melody.play();
}

Is there a way that I can alter the melody object after it has been created, before it’s being played? For example if I want to change the scale. I have tried this:

melody["scale"]("d4:major");
return melody.play();

and

return melody.scale("d4:major").play();

but neither works. Is it possible? What kind of “creature” (apart from being an object) is the melody object anyway?