Notes:
To start the JaMISS server, open a terminal type: java -jar jaMISS.To get help type: java -jar JaMISS.jar --help which will print this:
========================================================================
Java MIDI Sound Server started ... (ctrl-c to quit)
========================================================================
>> Detected OS: MAC OS X
JaMISS Help:
-------------------------------------------------------
Usage:
#java -jar jaMISS [arguments]
Command line arguments:
-p [port] Specifies the port to listen on (Default is 8006)
-d Enable diagnostic mode (No synth used, only prints data received)
--info Returns program info (what it does, packet format, etc...)
--help Returns program usage & parameters
JaMISS inputs are fairly robust.
- If the port argument is omitted, the default port (8006) is used.
- Parameters can be entered in any order
- Boundary conditions (ports, etc) are checked for validity
- Parameters are evaluated in logical order
(Example: '--help' in any location will override any other parameters)
Note that the diagnostic mode (-d) does NOT PLAY ANY SOUND. For more info use java -jar JaMISS.jar --info which prints this:
...
Functions:
1) Starts a Java MIDI synthesizer
2) Accepts connections on a given port
3) Allows remote control of sound creation & its parameters
In addition, there is a diagnostic mode.
In this mode, the program accepts connections, and simply prints the data it receives.
Communications:
JaMISS accepts socket connections on the specified port. The data format is as follows:
JaMISS,[command]
or
JaMISS,[channel],[note],[instrument],[velocity]
'JaMISS' is a header, and must precede every message string.
[command] can be either 'off' which turns off the note playing, or 'quit'
which shuts down the server.
[channel] is the range 0-15 (MIDI channels 1-16). 10 should be avoided (drum track only)
[note] is the range 0-127, but note that values too low are inaudible and
values too high are annoying.
[instrument] is the range 0-127, and selects the General MIDI instrument.
(examples: 0 is grand piano which decays, 81 is sqare wave which has infinite sustain.)
[velocity] is the intensity of the instrument. It may or may not be the
same as volume, depending on the sound.
To test the connection a running server, you can use the JaMISS client. To use a local server listening on port 8006, play a note on channel 0, with instrument 14, pitch 60 and volume 100, type: java -jar JaMISS_Client.jar localhost 8006 "JaMISS,0,60,14,120"
Note that the message is comma separated and must not have any whitespace. To kill the sound use: java -jar JaMISS_Client.jar localhost 8006 "JaMISS,off" and to force the server to close down use: java -jar JaMISS_Client.jar localhost 8006 "JaMISS,quit"
Here is a python program to play two intervals:
from socket import *
from time import sleep
# mini test client for JaMISS, assuming a local server listens on 8006
# the server requires a close and total rebuild of the socket
def playSound(channel, key, instrument, velocity):
ADDR = ("localhost", 8006)
sock = socket(AF_INET, SOCK_STREAM)
sock.connect(ADDR)
msg = "JaMISS," + str(channel) + "," + str(key) + "," + str(instrument-1) + "," + str(velocity)
sock.send(msg)
sock.close()
def stopSound():
ADDR = ("localhost", 8006)
sock = socket(AF_INET, SOCK_STREAM)
sock.connect(ADDR)
msg = "JaMISS,off"
sock.send(msg)
sock.close()
playSound(0, 60, 9, 127)
playSound(0, 62, 61, 70)
sleep(2.5) # floating point time in secs
stopSound()
playSound(0, 62, 9, 127)
playSound(0, 64, 61, 70)
sleep(2.5)
stopSound()