alda-lang / alda-server-clj

A Clojure implementation of an Alda server
Other
2 stars 2 forks source link

alda.error.UnsuccessfulException when trying to play note from REPL #16

Closed nblumoe closed 5 years ago

nblumoe commented 5 years ago

After starting the server:

$ alda -v up
[27713] Starting Alda server...
[27713] Server up ✓
[27713] Starting worker processes...
[27713] Ready ✓

And a REPL:

$ alda -v repl
 █████╗ ██╗     ██████╗  █████╗
██╔══██╗██║     ██╔══██╗██╔══██╗
███████║██║     ██║  ██║███████║
██╔══██║██║     ██║  ██║██╔══██║
██║  ██║███████╗██████╔╝██║  ██║
╚═╝  ╚═╝╚══════╝╚═════╝ ╚═╝  ╚═╝

             1.3.0
         repl session

Type :help for a list of available commands.

I tried to play a note, but ended up with an Exception:

> c
[27713] ERROR null

alda.error.UnsuccessfulException
    at alda.AldaServer.awaitAsyncResponse(AldaServer.java:542)
    at alda.AldaServer.play(AldaServer.java:381)
    at alda.AldaServer.playFromRepl(AldaServer.java:403)
    at alda.AldaServer.playFromRepl(AldaServer.java:389)
    at alda.repl.AldaRepl.run(AldaRepl.java:306)
    at alda.Main.main(Main.java:296)

My expectation was to hear the note playing.

I'm on macOS 10.14.4, Java info:

$ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

I have multiple MIDI devices available on the machine.

Happy to provider more logs/info as needed!

nblumoe commented 5 years ago

Oh nevermind. It works once I include the instrument:

piano: c

I was following along the tutorial on https://blog.djy.io/alda-a-manifesto-and-gentle-introduction/ and didn't expect an exception on the very first example (which is running c d e f on the REPL without an instrument).

daveyarwood commented 5 years ago

Hi @nblumoe , thanks for reporting this! I think sometime after I wrote that tutorial, I changed the API to make it less forgiving of not declaring an instrument, and some edges became rougher in the process. Sorry about that :)

I think the error message could be a lot nicer than ERROR null, so I'll re-open this issue with the goal of improving the error message to make it clear what's going on.

daveyarwood commented 5 years ago

Fixed via https://github.com/alda-lang/alda-sound-engine-clj/commit/f15392f8f0d05b1557a2fc9ca3d30e39d21d56a7.

It turns out that the problem was slightly different than I predicted. If you evaluate c (i.e. a score with no instruments) now, you should see the behavior described in the tutorial: silence and no error message.