Skip to content

A MIDI CLI tool and server written in Go, focused on supporting BEAM music apps via Erlang Ports

License

Notifications You must be signed in to change notification settings

geomyidia/midiserver

Repository files navigation

midiserver

Build Status Go Versions LFE Versions Erlang Versions

A MIDI CLI tool and server written in Go, focused on supporting BEAM music apps via Erlang Ports

Update: This repo is no longer being used for the undertone and undermidi projects; those are currently being updated to use the rtmidi Erlang NIF developed by the Sonic Pi project.

About

The executable built by this project is intended to:

  • communicate via messages with BEAM (Erlang language family) clients
  • to do so with messages created by midilib
  • to be controlled by a gen_server (e.g., see undermidi go server)
  • to be run as part of a supervision tree (e.g., see undermidi supervisor)

Usage

A typical execution looks like this:

./bin/midiserver -d -l warn -p exec

You can use it to test your MIDI setup:

./bin/midiserver list-devices
./bin/midiserver example 0 0

Full usage:

./bin/midiserver -h
Usage: ./bin/midiserver [flags] [commands] [args]

Flags:

  -d Daemonise midiserver; this disables the text parser; short-form flag
  -daemon
     Daemonise midiserver; this disables the text parser
  -epmd-host string
     Set hostname of the epmd to use (default "localhost")
  -epmd-port int
     Set port for the epmd to use (default 4369)
  -ergo.norecover
     disable panic catching
  -ergo.trace
     enable extended debug info
  -i int
     This needs to be a valid ID for a MIDI device capable of receiving
     MIDI data; for a list of valid IDs be sure to run the 'list-devices'
     command; short-form flag (default -1)
  -l string
     Set the logging level; short-form flag (default "warn")
  -log-reportcaller
     Indicate whether the log lines contain the report caller
  -loglevel string
     Set the logging level (default "warn")
  -midi-in int
     This needs to be a valid ID for a MIDI device capable of receiving
     MIDI data; for a list of valid IDs be sure to run the 'list-devices'
     command (default -1)
  -n string
     Set the Erlang node name for remote communications; short-form flag
  -p string
     Set the parser to user for commands and data. Legal values are:
     [exec, port, text]. Note that setting to 'text' disables
     daemonisation and setting any of the other parsers automatically
     enables daemonisation; short-form flag (default "text")
  -parser string
     Set the parser to user for commands and data. Legal values are:
     [exec, port, text]. Note that setting to 'text' disables
     daemonisation and setting any of the other parsers automatically
     enables daemonisation (default "text")
  -r Indicate whether the log lines contain the report caller; short-form flag
  -remote-module string
     Set the Erlang module for remote communications
  -remote-node string
     Set the Erlang node name for remote communications
  -v Display version/build info and exit; short-form flag
  -version
     Display version/build info and exit

Commands:

  example [args]
        An example piece of music will be played on given device and channel.
        Valid device numbers are any of the "out" devices in the output of
        the 'list-devices' command; valid channel numbers are any of the 16
        MIDI channels: 0 through 15. Default args: 0 0.
  list-devices
        This will list the MIDI devices currently recognised by the operating
        system, grouped by input devices and output devices.
  play-note [args]
        A pitch will be played with the default values for the arguments,
        optionally overridden. Positional args are the integer values for
        device, channel, pitch, velocity, and duration.  Valid device numbers
        are any of the "out" devices in the output of the 'list-devices'
        command; valid channel numbers are any of the 16 MIDI channels:
        0 through 15. Pitch and velocity are standard MIDI integer values for
        the same. Duration is in seconds. Default args: 0 0.
  ping
        Provided for testing purposes by Erlang Ports implementations. If the
        'remote-module' flag has been set, a ping will be attempted there
        instead.
  remote-port
        Query epmd for the port of the remote node (set with the -remote-node
        flag).
  version
        An alternate form of the version info with concise formatting.

License

Apache Version 2 License

Copyright © 2020-2022, Duncan McGreggor

About

A MIDI CLI tool and server written in Go, focused on supporting BEAM music apps via Erlang Ports

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published