--- web/trunk/www.linuxsampler.org/api/draft-linuxsampler-protocol.txt 2005/05/21 20:01:32 561 +++ web/trunk/www.linuxsampler.org/api/draft-linuxsampler-protocol.txt 2005/05/24 03:26:22 575 @@ -2,12 +2,12 @@ LinuxSampler Developers C. Schoenebeck Internet-Draft Interessengemeinschaft Software -Expires: November 19, 2005 Engineering e. V. - May 21, 2005 +Expires: November 22, 2005 Engineering e. V. + May 24, 2005 LinuxSampler Control Protocol - lscp.txt + LSCP 1.0 Status of this Memo @@ -30,7 +30,7 @@ The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. - This Internet-Draft will expire on November 19, 2005. + This Internet-Draft will expire on November 22, 2005. Copyright Notice @@ -40,9 +40,9 @@ The LinuxSampler Control Protocol (LSCP) is an application-level protocol primarily intended for local and remote controlling the - LinuxSampler main application, which is a sophisticated console - application essentially playing back audio samples and manipulating - the samples in real time to certain extent. + LinuxSampler backend application, which is a sophisticated + server-like console application essentially playing back audio + samples and manipulating the samples in real time to certain extent. @@ -52,7 +52,7 @@ -Schoenebeck Expires November 19, 2005 [Page 1] +Schoenebeck Expires November 22, 2005 [Page 1] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -60,100 +60,102 @@ Table of Contents 1. Requirements notation . . . . . . . . . . . . . . . . . . . 4 - 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 - 3. Focus of this protocol . . . . . . . . . . . . . . . . . . . 6 - 4. Communication Overview . . . . . . . . . . . . . . . . . . . 7 - 4.1 Request/response communication method . . . . . . . . . . 7 - 4.1.1 Result format . . . . . . . . . . . . . . . . . . . . 8 - 4.2 Subscribe/notify communication method . . . . . . . . . . 9 - 5. Description for control commands . . . . . . . . . . . . . . 12 - 5.1 Ignored lines and comments . . . . . . . . . . . . . . . . 12 - 5.2 Configuring audio drivers . . . . . . . . . . . . . . . . 12 - 5.2.1 Getting amount of available audio output drivers . . . 12 - 5.2.2 Getting all available audio output drivers . . . . . . 13 - 5.2.3 Getting information about a specific audio output - driver . . . . . . . . . . . . . . . . . . . . . . . . 13 - 5.2.4 Getting information about specific audio output - driver parameter . . . . . . . . . . . . . . . . . . . 14 - 5.2.5 Creating an audio output device . . . . . . . . . . . 17 - 5.2.6 Destroying an audio output device . . . . . . . . . . 17 - 5.2.7 Getting all created audio output device count . . . . 18 - 5.2.8 Getting all created audio output device list . . . . . 18 - 5.2.9 Getting current settings of an audio output device . . 19 - 5.2.10 Changing settings of audio output devices . . . . . 20 - 5.2.11 Getting information about an audio channel . . . . . 20 - 5.2.12 Getting information about specific audio channel - parameter . . . . . . . . . . . . . . . . . . . . . 22 - 5.2.13 Changing settings of audio output channels . . . . . 23 - 5.3 Configuring MIDI input drivers . . . . . . . . . . . . . . 24 - 5.3.1 Getting amount of available MIDI input drivers . . . . 24 - 5.3.2 Getting all available MIDI input drivers . . . . . . . 25 - 5.3.3 Getting information about a specific MIDI input - driver . . . . . . . . . . . . . . . . . . . . . . . . 25 - 5.3.4 Getting information about specific MIDI input - driver parameter . . . . . . . . . . . . . . . . . . . 26 - 5.3.5 Creating a MIDI input device . . . . . . . . . . . . . 28 - 5.3.6 Destroying a MIDI input device . . . . . . . . . . . . 29 - 5.3.7 Getting all created MIDI input device count . . . . . 29 - 5.3.8 Getting all created MIDI input device list . . . . . . 29 - 5.3.9 Getting current settings of a MIDI input device . . . 30 - 5.3.10 Changing settings of MIDI input devices . . . . . . 31 - 5.3.11 Getting information about a MIDI port . . . . . . . 31 - 5.3.12 Getting information about specific MIDI port - parameter . . . . . . . . . . . . . . . . . . . . . 32 - 5.3.13 Changing settings of MIDI input ports . . . . . . . 33 - 5.4 Configuring sampler channels . . . . . . . . . . . . . . . 34 - 5.4.1 Loading an instrument . . . . . . . . . . . . . . . . 34 - 5.4.2 Loading a sampler engine . . . . . . . . . . . . . . . 35 - - - -Schoenebeck Expires November 19, 2005 [Page 2] - -Internet-Draft LinuxSampler Control Protocol May 2005 - - - 5.4.3 Getting all created sampler channel count . . . . . . 36 - 5.4.4 Getting all created sampler channel list . . . . . . . 36 - 5.4.5 Adding a new sampler channel . . . . . . . . . . . . . 36 - 5.4.6 Removing a sampler channel . . . . . . . . . . . . . . 37 - 5.4.7 Getting amount of available engines . . . . . . . . . 38 - 5.4.8 Getting all available engines . . . . . . . . . . . . 38 - 5.4.9 Getting information about an engine . . . . . . . . . 38 - 5.4.10 Getting sampler channel information . . . . . . . . 39 - 5.4.11 Current number of active voices . . . . . . . . . . 41 - 5.4.12 Current number of active disk streams . . . . . . . 41 - 5.4.13 Current fill state of disk stream buffers . . . . . 42 - 5.4.14 Setting audio output device . . . . . . . . . . . . 42 - 5.4.15 Setting audio output type . . . . . . . . . . . . . 43 - 5.4.16 Setting audio output channel . . . . . . . . . . . . 44 - 5.4.17 Setting MIDI input device . . . . . . . . . . . . . 44 - 5.4.18 Setting MIDI input type . . . . . . . . . . . . . . 45 - 5.4.19 Setting MIDI input port . . . . . . . . . . . . . . 45 - 5.4.20 Setting MIDI input channel . . . . . . . . . . . . . 46 - 5.4.21 Setting channel volume . . . . . . . . . . . . . . . 46 - 5.4.22 Resetting a sampler channel . . . . . . . . . . . . 47 - 5.5 Controlling connection . . . . . . . . . . . . . . . . . . 48 - 5.5.1 Register front-end for receiving event messages . . . 48 - 5.5.2 Unregister front-end for not receiving event - messages . . . . . . . . . . . . . . . . . . . . . . . 48 - 5.5.3 Enable or disable echo of commands . . . . . . . . . . 49 - 5.5.4 Close client connection . . . . . . . . . . . . . . . 49 - 5.6 Global commands . . . . . . . . . . . . . . . . . . . . . 50 - 5.6.1 Reset sampler . . . . . . . . . . . . . . . . . . . . 50 - 6. Command Syntax . . . . . . . . . . . . . . . . . . . . . . . 51 - 7. Events . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 - 7.1 Number of sampler channels changed . . . . . . . . . . . . 52 - 7.2 Number of active voices changed . . . . . . . . . . . . . 52 - 7.3 Number of active disk streams changed . . . . . . . . . . 52 - 7.4 Disk stream buffer fill state changed . . . . . . . . . . 53 - 7.5 Channel information changed . . . . . . . . . . . . . . . 53 - 7.6 Miscellaneous and debugging events . . . . . . . . . . . . 53 - 8. Security Considerations . . . . . . . . . . . . . . . . . . 55 - 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 56 - 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 56 - Author's Address . . . . . . . . . . . . . . . . . . . . . . 56 - Intellectual Property and Copyright Statements . . . . . . . 57 + 2. Versioning of this specification . . . . . . . . . . . . . . 5 + 3. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 + 4. Focus of this protocol . . . . . . . . . . . . . . . . . . . 7 + 5. Communication Overview . . . . . . . . . . . . . . . . . . . 8 + 5.1 Request/response communication method . . . . . . . . . . 8 + 5.1.1 Result format . . . . . . . . . . . . . . . . . . . . 9 + 5.2 Subscribe/notify communication method . . . . . . . . . . 10 + 6. Description for control commands . . . . . . . . . . . . . . 13 + 6.1 Ignored lines and comments . . . . . . . . . . . . . . . . 13 + 6.2 Configuring audio drivers . . . . . . . . . . . . . . . . 13 + 6.2.1 Getting amount of available audio output drivers . . . 13 + 6.2.2 Getting all available audio output drivers . . . . . . 14 + 6.2.3 Getting information about a specific audio output + driver . . . . . . . . . . . . . . . . . . . . . . . . 14 + 6.2.4 Getting information about specific audio output + driver parameter . . . . . . . . . . . . . . . . . . . 15 + 6.2.5 Creating an audio output device . . . . . . . . . . . 18 + 6.2.6 Destroying an audio output device . . . . . . . . . . 18 + 6.2.7 Getting all created audio output device count . . . . 19 + 6.2.8 Getting all created audio output device list . . . . . 19 + 6.2.9 Getting current settings of an audio output device . . 20 + 6.2.10 Changing settings of audio output devices . . . . . 21 + 6.2.11 Getting information about an audio channel . . . . . 21 + 6.2.12 Getting information about specific audio channel + parameter . . . . . . . . . . . . . . . . . . . . . 23 + 6.2.13 Changing settings of audio output channels . . . . . 24 + 6.3 Configuring MIDI input drivers . . . . . . . . . . . . . . 25 + 6.3.1 Getting amount of available MIDI input drivers . . . . 26 + 6.3.2 Getting all available MIDI input drivers . . . . . . . 26 + 6.3.3 Getting information about a specific MIDI input + driver . . . . . . . . . . . . . . . . . . . . . . . . 26 + 6.3.4 Getting information about specific MIDI input + driver parameter . . . . . . . . . . . . . . . . . . . 27 + 6.3.5 Creating a MIDI input device . . . . . . . . . . . . . 29 + 6.3.6 Destroying a MIDI input device . . . . . . . . . . . . 30 + 6.3.7 Getting all created MIDI input device count . . . . . 30 + 6.3.8 Getting all created MIDI input device list . . . . . . 31 + 6.3.9 Getting current settings of a MIDI input device . . . 31 + 6.3.10 Changing settings of MIDI input devices . . . . . . 32 + 6.3.11 Getting information about a MIDI port . . . . . . . 33 + 6.3.12 Getting information about specific MIDI port + parameter . . . . . . . . . . . . . . . . . . . . . 33 + 6.3.13 Changing settings of MIDI input ports . . . . . . . 35 + 6.4 Configuring sampler channels . . . . . . . . . . . . . . . 35 + 6.4.1 Loading an instrument . . . . . . . . . . . . . . . . 35 + + + +Schoenebeck Expires November 22, 2005 [Page 2] + +Internet-Draft LinuxSampler Control Protocol May 2005 + + + 6.4.2 Loading a sampler engine . . . . . . . . . . . . . . . 36 + 6.4.3 Getting all created sampler channel count . . . . . . 37 + 6.4.4 Getting all created sampler channel list . . . . . . . 37 + 6.4.5 Adding a new sampler channel . . . . . . . . . . . . . 38 + 6.4.6 Removing a sampler channel . . . . . . . . . . . . . . 39 + 6.4.7 Getting amount of available engines . . . . . . . . . 39 + 6.4.8 Getting all available engines . . . . . . . . . . . . 39 + 6.4.9 Getting information about an engine . . . . . . . . . 40 + 6.4.10 Getting sampler channel information . . . . . . . . 41 + 6.4.11 Current number of active voices . . . . . . . . . . 42 + 6.4.12 Current number of active disk streams . . . . . . . 43 + 6.4.13 Current fill state of disk stream buffers . . . . . 43 + 6.4.14 Setting audio output device . . . . . . . . . . . . 44 + 6.4.15 Setting audio output type . . . . . . . . . . . . . 45 + 6.4.16 Setting audio output channel . . . . . . . . . . . . 45 + 6.4.17 Setting MIDI input device . . . . . . . . . . . . . 46 + 6.4.18 Setting MIDI input type . . . . . . . . . . . . . . 46 + 6.4.19 Setting MIDI input port . . . . . . . . . . . . . . 47 + 6.4.20 Setting MIDI input channel . . . . . . . . . . . . . 48 + 6.4.21 Setting channel volume . . . . . . . . . . . . . . . 48 + 6.4.22 Resetting a sampler channel . . . . . . . . . . . . 49 + 6.5 Controlling connection . . . . . . . . . . . . . . . . . . 49 + 6.5.1 Register front-end for receiving event messages . . . 49 + 6.5.2 Unregister front-end for not receiving event + messages . . . . . . . . . . . . . . . . . . . . . . . 50 + 6.5.3 Enable or disable echo of commands . . . . . . . . . . 51 + 6.5.4 Close client connection . . . . . . . . . . . . . . . 51 + 6.6 Global commands . . . . . . . . . . . . . . . . . . . . . 51 + 6.6.1 Reset sampler . . . . . . . . . . . . . . . . . . . . 51 + 6.6.2 General sampler informations . . . . . . . . . . . . . 52 + 7. Command Syntax . . . . . . . . . . . . . . . . . . . . . . . 53 + 8. Events . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 + 8.1 Number of sampler channels changed . . . . . . . . . . . . 58 + 8.2 Number of active voices changed . . . . . . . . . . . . . 58 + 8.3 Number of active disk streams changed . . . . . . . . . . 58 + 8.4 Disk stream buffer fill state changed . . . . . . . . . . 59 + 8.5 Channel information changed . . . . . . . . . . . . . . . 59 + 8.6 Miscellaneous and debugging events . . . . . . . . . . . . 59 + 9. Security Considerations . . . . . . . . . . . . . . . . . . 61 + 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 62 + 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 62 + Author's Address . . . . . . . . . . . . . . . . . . . . . . 62 + Intellectual Property and Copyright Statements . . . . . . . 63 @@ -162,9 +164,7 @@ - - -Schoenebeck Expires November 19, 2005 [Page 3] +Schoenebeck Expires November 22, 2005 [Page 3] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -220,12 +220,68 @@ -Schoenebeck Expires November 19, 2005 [Page 4] +Schoenebeck Expires November 22, 2005 [Page 4] Internet-Draft LinuxSampler Control Protocol May 2005 -2. Introduction +2. Versioning of this specification + + LSCP will certainly be extended and enhanced by-and-by. Each + official release of the LSCP specification will be tagged with a + unique version tuple. The version tuple consists at least of a major + and minor version number like: + + "1.2" + + In this example the major version number would be "1" and the minor + version number would be "2". Note that the version tuple might also + have more than two elements. The major version number defines a + group of backward compatible versions. That means a frontend is + compatible to the connected sampler if and only if the LSCP versions + to which each of the two parties complies to, match both of the + following rules: + + Compatibility: + + 1. The frontend's LSCP major version and the sampler's LSCP major + version are exactly equal. + 2. The frontend's LSCP minor version is less or equal than the + sampler's LSCP minor version. + + Compatibility can only be claimed if both rules are true. The + frontend can use the "GET SERVER INFO" (Section 6.6.2) command to get + the version of the LSCP specification the sampler complies with. + + + + + + + + + + + + + + + + + + + + + + + + +Schoenebeck Expires November 22, 2005 [Page 5] + +Internet-Draft LinuxSampler Control Protocol May 2005 + + +3. Introduction LinuxSampler is a so called software sampler application capable to playback audio samples from a computer's Random Access Memory (RAM) @@ -237,7 +293,7 @@ connected to an arbitrary MIDI input method and arbitrary MIDI channel (e.g. sampler channel 17 could be connected to an ALSA sequencer device 64:0 and listening to MIDI channel 1 there). Each - sampler engine will be assigned an own instance of one of the + sampler channel will be associated with an instance of one of the available sampler engines (e.g. GigEngine, DLSEngine). The audio output of each sampler channel can be routed to an arbitrary audio output method (ALSA / JACK) and an arbitrary audio output channel @@ -276,12 +332,12 @@ -Schoenebeck Expires November 19, 2005 [Page 5] +Schoenebeck Expires November 22, 2005 [Page 6] Internet-Draft LinuxSampler Control Protocol May 2005 -3. Focus of this protocol +4. Focus of this protocol Main focus of this protocol is to provide a way to configure a running LinuxSampler instance and to retrieve information about it. @@ -332,12 +388,12 @@ -Schoenebeck Expires November 19, 2005 [Page 6] +Schoenebeck Expires November 22, 2005 [Page 7] Internet-Draft LinuxSampler Control Protocol May 2005 -4. Communication Overview +5. Communication Overview There are two distinct methods of communication between a running instance of LinuxSampler and one or more control applications, so @@ -349,29 +405,29 @@ more effort to be implemented in the front-end application. The two communication methods will be described next. -4.1 Request/response communication method +5.1 Request/response communication method - This simple communication method is based on TCP. The front-end - application establishes a TCP connection to the LinuxSampler instance - on a certain host system. Then the front-end application will send - certain ASCII based commands as defined in this document (every - command line must be CRLF terminated - see "Conventions used in this - document" at the beginning of this document) and the LinuxSampler - application will response after a certain process time with an - appropriate ASCII based answer, also as defined in this document. So - this TCP communication is simply based on query and answer paradigm. - That way LinuxSampler is only able to answer on queries from - front-ends, but not able to automatically send messages to the client - if it's not asked to. The fronted should not reconnect to - LinuxSampler for every single command, instead it should keep the - connection established and simply resend message(s) for subsequent - commands. To keep information in the front-end up-to-date the - front-end has to periodically send new requests to get the current - information from the LinuxSampler instance. This is often referred - to as "polling". While polling is simple to implement and may be OK - to use in some cases, there may be disadvantages to polling such as - network traffic overhead and information being out of date. It is - possible for a client or several clients to open more than one + This simple communication method is based on TCP [RFC793]. The + front-end application establishes a TCP connection to the + LinuxSampler instance on a certain host system. Then the front-end + application will send certain ASCII based commands as defined in this + document (every command line must be CRLF terminated - see + "Conventions used in this document" at the beginning of this + document) and the LinuxSampler application will response after a + certain process time with an appropriate ASCII based answer, also as + defined in this document. So this TCP communication is simply based + on query and answer paradigm. That way LinuxSampler is only able to + answer on queries from front-ends, but not able to automatically send + messages to the client if it's not asked to. The fronted should not + reconnect to LinuxSampler for every single command, instead it should + keep the connection established and simply resend message(s) for + subsequent commands. To keep information in the front-end up-to-date + the front-end has to periodically send new requests to get the + current information from the LinuxSampler instance. This is often + referred to as "polling". While polling is simple to implement and + may be OK to use in some cases, there may be disadvantages to polling + such as network traffic overhead and information being out of date. + It is possible for a client or several clients to open more than one connection to the server at the same time. It is also possible to send more than one request to the server at the same time but if those requests are sent over the same connection server MUST execute @@ -388,12 +444,12 @@ -Schoenebeck Expires November 19, 2005 [Page 7] +Schoenebeck Expires November 22, 2005 [Page 8] Internet-Draft LinuxSampler Control Protocol May 2005 -4.1.1 Result format +5.1.1 Result format Result set could be one of the following types: @@ -444,7 +500,7 @@ -Schoenebeck Expires November 19, 2005 [Page 8] +Schoenebeck Expires November 22, 2005 [Page 9] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -490,7 +546,7 @@ C: "CREATE AUDIO_OUTPUT_DEVICE ALSA SAMPLERATE=96000" S: "WRN[0]:32:Sample rate not supported, using 44100 instead." -4.2 Subscribe/notify communication method +5.2 Subscribe/notify communication method This more sophisticated communication method is actually only an extension of the simple request/response communication method. The @@ -500,7 +556,7 @@ -Schoenebeck Expires November 19, 2005 [Page 9] +Schoenebeck Expires November 22, 2005 [Page 10] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -542,7 +598,7 @@ where will be replace by the respective event that client is no longer interested in receiving. For a list of supported events - see Section 7. + see Section 8. Example: the fill states of disk stream buffers have changed on sampler channel 4 and the LinuxSampler instance will react by sending @@ -556,7 +612,7 @@ -Schoenebeck Expires November 19, 2005 [Page 10] +Schoenebeck Expires November 22, 2005 [Page 11] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -612,27 +668,27 @@ -Schoenebeck Expires November 19, 2005 [Page 11] +Schoenebeck Expires November 22, 2005 [Page 12] Internet-Draft LinuxSampler Control Protocol May 2005 -5. Description for control commands +6. Description for control commands This chapter will describe the available control commands that can be sent on the TCP connection in detail. Some certain commands (e.g. - "GET CHANNEL INFO" (Section 5.4.10) or "GET ENGINE INFO" (Section - 5.4.9)) lead to multiple-line responses. In this case LinuxSampler + "GET CHANNEL INFO" (Section 6.4.10) or "GET ENGINE INFO" (Section + 6.4.9)) lead to multiple-line responses. In this case LinuxSampler signals the end of the response by a "." (single dot) line. -5.1 Ignored lines and comments +6.1 Ignored lines and comments White lines, that is lines which only contain space and tabulator characters, and lines that start with a "#" character are ignored, thus it's possible for example to group commands and to place comments in a LSCP script file. -5.2 Configuring audio drivers +6.2 Configuring audio drivers Instances of drivers in LinuxSampler are called devices. You can use multiple audio devices simultaneously, e.g. to output the sound of @@ -661,14 +717,14 @@ retrieve what parameters drivers are offering, how to retrieve their possible values, etc. -5.2.1 Getting amount of available audio output drivers +6.2.1 Getting amount of available audio output drivers Use the following command to get the number of audio output drivers currently available for the LinuxSampler instance: -Schoenebeck Expires November 19, 2005 [Page 12] +Schoenebeck Expires November 22, 2005 [Page 13] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -685,7 +741,7 @@ C: "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS" S: "2" -5.2.2 Getting all available audio output drivers +6.2.2 Getting all available audio output drivers Use the following command to list all audio output drivers currently available for the LinuxSampler instance: @@ -702,7 +758,7 @@ C: "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS" S: "ALSA,JACK" -5.2.3 Getting information about a specific audio output driver +6.2.3 Getting information about a specific audio output driver Use the following command to get detailed information about a specific audio output driver: @@ -710,7 +766,7 @@ GET AUDIO_OUTPUT_DRIVER INFO Where is the name of the audio output driver, - returned by the "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS" (Section 5.2.2) + returned by the "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS" (Section 6.2.2) command. Possible Answers: @@ -724,7 +780,7 @@ -Schoenebeck Expires November 19, 2005 [Page 13] +Schoenebeck Expires November 22, 2005 [Page 14] Internet-Draft LinuxSampler Control Protocol May 2005 @@ -750,7 +806,7 @@ FRAGMENTSIZE,CARD" "." -5.2.4 Getting information about specific audio output driver parameter +6.2.4 Getting information about specific audio output driver parameter Use the following command to get detailed information about a specific audio output driver parameter: @@ -758,10 +814,10 @@ GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO