module Alda

The module serving as a namespace.



The array of available subcommands of alda executable.

Alda is able to invoke alda at the command line. The subcommand is the name of the method invoked upon Alda.

The keyword arguments are interpreted as the subcommand options. To specify the command options, use ::[].

The return value is the string output by the command in STDOUT.

If the exit code is nonzero, an Alda::CommandLineError is raised.

# => "Client version: 1.4.0\nServer version: [27713] 1.4.0\n"
Alda.parse code: 'bassoon: o3 c'
# => "{\"chord-mode\":false,\"current-instruments\":...}\n"

The available commands are: help, update, repl, up, start_server, init, down, stop_server, downup, restart_server, list, status, version, play, stop, parse, instruments, and export.


The version number of alda-rb.

The same as that in alda-rb gem spec.



The path to the alda executable.

The default value is "alda", which will depend on your PATH.


The commandline options set using ::[]. Not the subcommand options. Clear it using ::clear_options.

Public Class Methods

Alda[**opts] → self click to toggle source

Sets the options of alda command. Not the subcommand options.

Alda[port: 1108].up # => "[1108] ..."
Alda.status # => "[1108] ..."

Further set options will be merged. The options can be seen by ::options. To clear them, use ::clear_options.

# File lib/alda-rb/commandline.rb, line 100
def [] **opts
  @options.merge! opts
clear_options() → nil click to toggle source

Clears the command line options. Makes ::options an empty Array.

# File lib/alda-rb/commandline.rb, line 111
def clear_options
down? → true or false click to toggle source

Whether the alda server is down.

# File lib/alda-rb/commandline.rb, line 133
def down?
  status.include? 'down'
repl() → nil click to toggle source

Start a REPL session.

# File lib/alda-rb/repl.rb, line 12
def Alda.repl
up?() → true or false click to toggle source

Whether the alda server is up.

# File lib/alda-rb/commandline.rb, line 124
def up?
  status.include? 'up'