The JFugue library is a cool way to make music programmatically!

Here’s a quick way to sandbox it in scala.

Start by making a new directory. Then,

wget http://www.jfugue.org/jfugue-5.0.9.jar
scala

inside scala repl (turn on your speakers!):

:require jfugue-5.0.9.jar
/*
* Added 'jfugue/jfugue-5.0.9.jar' to classpath.
*/

import org.jfugue.player.Player

val player = new Player()

player.play("C E G B G E")

If you prefer to sandbox in a file, it is possible to quickly execute the file as a script with the library on the classpath by executing the following:

scala -classpath jfugue-5.0.9.jar MyDemoScript.scala