Hey, I got a crazy idea! Wouldn't be great if you could add background music to your games in a real simple way.

For example by describing the music by a few words, like "mysterious forrest" or "stress"?

Well, it turns out that I have constructed a thing I call the Music Generator that allows you to do exactly these things.

Let's try it out

1

Type the following into the the box where it says Enter source code here:

setMusicPremiss('mysterious');
startMusic();
2

Click Check source code.

3

Click Run!.

So what is happening here?

The function setMusicPremiss() takes one argument, a string containing words that describes the desired music. The function startMusic() will start the music when called.

You can call the function stopMusic() when you want to stop the music.

Now, for fun. Try this:

setMusicPremiss('background');
startMusic();

or this:

setMusicPremiss('sad');
startMusic();