--- linuxsampler/trunk/Documentation/lscp.xml 2007/12/04 18:20:16 1544 +++ linuxsampler/trunk/Documentation/lscp.xml 2009/11/01 18:47:59 2025 @@ -16,7 +16,7 @@ to an annoying "missing Normative/Informative References" error message --> - + LinuxSampler Control Protocol + S: OK + + + Example (Windows): + + + C: LOAD INSTRUMENT 'D:/MySounds/cello.gig' 0 0 + S: OK @@ -2504,7 +2512,7 @@ numerical ID of the audio output device which is currently connected to this sampler channel to output - the audio signal, "NONE" if there's no device + the audio signal, "-1" if there's no device connected to this sampler channel @@ -2535,7 +2543,9 @@ INSTRUMENT_NR - - the instrument index number of the loaded instrument + the instrument index number of the loaded instrument, + "-1" if there's no instrument loaded for this sampler + channel INSTRUMENT_NAME - @@ -2547,8 +2557,11 @@ INSTRUMENT_STATUS - - integer values 0 to 100 indicating loading progress percentage for the instrument. Negative - value indicates a loading exception. Value of 100 indicates that the instrument is fully + Integer values 0 to 100 indicating loading progress + percentage for the instrument. Negative + value indicates a loading exception (also returns "-1" in case no + instrument was yet to be loaded on the sampler channel). + Value of 100 indicates that the instrument is fully loaded. @@ -2556,13 +2569,15 @@ numerical ID of the MIDI input device which is currently connected to this sampler channel to deliver - MIDI input commands, "NONE" if there's no device + MIDI input commands, "-1" if there's no device connected to this sampler channel MIDI_INPUT_PORT - - port number of the MIDI input device + port number of the MIDI input device (in case a + MIDI device was already assigned to the sampler + channel) MIDI_INPUT_CHANNEL - @@ -3703,6 +3718,71 @@ +
+ The front-end can send MIDI events to a specific sampler channel + by sending the following command: + + + SEND CHANNEL MIDI_DATA <midi-msg> <sampler-chan> <arg1> <arg2> + + + Where <sampler-chan> is the sampler channel number + as returned by the "ADD CHANNEL" + or "LIST CHANNELS" command, + <arg1> and <arg2> arguments depend on the <midi-msg> argument, which + specifies the MIDI message type. Currently, the following MIDI messages are supported: + + + "NOTE_ON" - + + For turning on MIDI notes, where <arg1> + specifies the key number and <arg2> the velocity + as described in the MIDI specification. + + + "NOTE_OFF" - + + For turning a currently playing MIDI note off, where <arg1> + specifies the key number and <arg2> the velocity + as described in the MIDI specification. + + + "CC" - + + For changing a MIDI controller, where <arg1> + specifies the controller number and <arg2> the + new value of the controller as described in the Control + Change section of the MIDI specification. + + + + + CAUTION: This command is provided for implementations of virtual MIDI keyboards + and no realtime guarantee whatsoever will be made! + Possible Answers: + + + "OK" - + + on success + + + "ERR:<error-code>:<error-message>" - + + in case it failed, providing an appropriate error code and error message + + + + + Example: + + + C: "SEND CHANNEL MIDI_DATA NOTE_ON 0 56 112" + S: "OK" + + +
+
The front-end can reset a particular sampler channel by sending the following command: @@ -4077,6 +4157,143 @@
+ +
+ The client can ask for the current global sampler-wide limit + for maximum voices by sending the following command: + + + GET VOICES + + + Possible Answers: + + + LinuxSampler will answer by returning the number for + the current limit of maximum voices. + + + + The voice limit setting defines how many voices should maximum + be processed by the sampler at the same time. If the user + triggers new notes which would exceed that voice limit, the + sampler engine will react by stealing old voices for those + newly triggered notes. Note that the amount of voices triggered + by a new note can be larger than one and is dependent to the + respective instrument and probably further criterias. +
+ +
+ The client can alter the current global sampler-wide limit + for maximum voices by sending the following command: + + + SET VOICES <max-voices> + + + Where <max-voices> should be replaced by the integer + value, reflecting the new global amount limit of maximum voices. + This value has to be larger than 0. + + Possible Answers: + + + "OK" - + + on success + + + "WRN:<warning-code>:<warning-message>" - + + if the voice limit was set, but there are noteworthy + issue(s) related, providing an appropriate warning code and + warning message + + + "ERR:<error-code>:<error-message>" - + + in case it failed, providing an appropriate error code and error message + + + + + + Note: the given value will be passed to all sampler engine instances. + The total amount of maximum voices on the running system might thus + be as big as the given value multiplied by the current amount of engine + instances. + + Caution: when adjusting the voice limit, you SHOULD also + adjust the disk stream limit respectively and vice versa. +
+ +
+ The client can ask for the current global sampler-wide limit + for maximum disk streams by sending the following command: + + + GET STREAMS + + + Possible Answers: + + + LinuxSampler will answer by returning the number for + the current limit of maximum disk streams. + + + + The disk stream limit setting defines how many disk streams should + maximum be processed by a sampler engine at the same time. The + higher this value, the more memory (RAM) will be occupied, since + every disk streams allocates a certain buffer size for being able + to perform its streaming operations. +
+ +
+ The client can alter the current global sampler-wide limit + for maximum disk streams by sending the following command: + + + SET STREAMS <max-streams> + + + Where <max-streams> should be replaced by the integer + value, reflecting the new global amount limit of maximum disk streams. + This value has to be positive. + + Possible Answers: + + + "OK" - + + on success + + + "WRN:<warning-code>:<warning-message>" - + + if the disk stream limit was set, but there are noteworthy + issue(s) related, providing an appropriate warning code and + warning message + + + "ERR:<error-code>:<error-message>" - + + in case it failed, providing an appropriate error code and error message + + + + + + Note: the given value will be passed to all sampler engine instances. + The total amount of maximum disk streams on the running system might + thus be as big as the given value multiplied by the current amount of + engine instances. + + Caution: when adjusting the disk stream limit, you SHOULD also + adjust the voice limit respectively and vice versa. +
+ @@ -5285,7 +5502,7 @@ to the instruments database by sending the following command: - ADD DB_INSTRUMENTS [NON_MODAL] [<mode>] <db_dir> <file_path> [<instr_index>] + ADD DB_INSTRUMENTS [NON_MODAL] [<mode>[ FILE_AS_DIR]] <db_dir> <file_path> [<instr_index>] Where <db_dir> is the absolute path name of a directory @@ -5330,6 +5547,10 @@ + If FILE_AS_DIR argument is supplied, all instruments in an instrument + file will be added to a separate directory in the instruments database, which + name will be the name of the instrument file with the file extension stripped off. + The difference between regular and NON_MODAL versions of the command is that the regular command returns when the scanning is finished while NON_MODAL version returns immediately and a background process is launched. @@ -5733,7 +5954,7 @@ Where <instr> is the absolute path name of the instrument and - <desc> is the new description for the instrument + <desc> is the new description for the instrument (encapsulated into apostrophes, supporting escape sequences as described in chapter "Character Set and Escape Sequences"). @@ -5976,7 +6197,7 @@ FORMAT INSTRUMENTS_DB - + Possible Answers: @@ -5995,6 +6216,72 @@ +
+ The front-end can retrieve the list of all instrument files in the instruments database + that don't exist in the filesystem by sending the following command: + + + FIND LOST DB_INSTRUMENT_FILES + + + + Possible Answers: + + + A comma separated list with the absolute path names + (encapsulated into apostrophes) of all lost instrument files. + "ERR:<error-code>:<error-message>" - + + in case it failed, providing an appropriate error code and error message. + + + + + Example: + + + C: "FIND LOST DB_INSTRUMENT_FILES" + S: "'/gigs/Bosendorfer 290.gig','/gigs/Steinway D.gig','/gigs/Free Piano.gig'" + + +
+ +
+ The front-end can substitute all occurrences of an instrument file + in the instruments database with a new one by sending the following command: + + + SET DB_INSTRUMENT FILE_PATH <old_path> <new_path> + + + Where <old_path> is the absolute path name of the instrument file + to substitute with <new_path>. + + Possible Answers: + + + "OK" - + + on success + + + "ERR:<error-code>:<error-message>" - + + in case it failed, providing an appropriate error code and error message. + + + + + + Example: + + + C: "SET DB_INSTRUMENT FILE_PATH '/gigs/Bosendorfer 290.gig' '/gigs/pianos/Bosendorfer 290.gig'" + S: "OK" + + +
+ @@ -6073,8 +6360,201 @@ - +
+ You can query detailed informations about files located + at the same system where the sampler instance is running on. + Using this command set allows to retrieve file informations + even remotely from another machine. + +
+ The front-end can retrieve the amount of instruments + within a given instrument file by sending the + following command: + + + GET FILE INSTRUMENTS <filename> + + + Where <filename> is the name of the instrument + file (encapsulated into apostrophes, supporting escape + sequences as described in chapter + "Character Set and Escape + Sequences"). + + The sampler will try to ask all sampler engines, + whether they support the given file and ask the first + engine with a positive answer for the amount of + instruments. + + Possible Answers: + + + On success, the sampler will answer by + returning the amount of instruments. + + "ERR:<error-code>:<error-message>" - + + if the file could not be handled + + + + + + Examples: + + + C: "GET FILE INSTRUMENTS 'D:/Sounds/Foo.gig'" + S: "10" + + +
+ +
+ The front-end can retrieve a list of all instruments + within a given instrument file by sending the + following command: + + + LIST FILE INSTRUMENTS <filename> + + + Where <filename> is the name of the instrument + file (encapsulated into apostrophes, supporting escape + sequences as described in chapter + "Character Set and Escape + Sequences"). + + The sampler will try to ask all sampler engines, + whether they support the given file and ask the first + engine with a positive answer for a list of IDs for the + instruments in the given file. + + Possible Answers: + + + On success, the sampler will answer by + returning a comma separated list of + instrument IDs. + + "ERR:<error-code>:<error-message>" - + + if the file could not be handled + + + + + + Examples: + + + C: "LIST FILE INSTRUMENTS 'D:/Sounds/Foo.gig'" + S: "0,1,2,3,4,5,6,7,8,9" + + +
+ +
+ The front-end can retrieve detailed informations + about a specific instrument within a given instrument + file by sending the following command: + + + GET FILE INSTRUMENT INFO <filename> + <instr-id> + + + Where <filename> is the name of the instrument + file (encapsulated into apostrophes, supporting escape + sequences as described in chapter + "Character Set and Escape + Sequences") and <instr-id> is the numeric + instrument ID as returned by the + + "LIST FILE INSTRUMENTS" command. + + The sampler will try to ask all sampler engines, + whether they support the given file and ask the first + engine with a positive answer for informations about the + specific instrument in the given file. + + Possible Answers: + + + LinuxSampler will answer by sending a <CRLF> separated list. + Each answer line begins with the settings category name + followed by a colon and then a space character <SP> and finally + the info character string to that setting category. At the + moment the following categories are defined: + + + + NAME - + + name of the instrument as + stored in the instrument file + + + FORMAT_FAMILY - + + name of the sampler format + of the given instrument + + + FORMAT_VERSION - + + version of the sampler format + the instrumen is stored as + + + PRODUCT - + + official product name of the + instrument as stored in the file + + + + ARTISTS - + + artists / sample library + vendor of the instrument + + + KEY_BINDINGS - + + comma separated list of integer values representing + the instrument's key mapping in the range between 0 .. 127, + reflecting the analog meaning of the MIDI specification. + + + KEYSWITCH_BINDINGS - + + comma separated list of integer values representing + the instrument's keyswitch mapping in the range between 0 .. 127, + reflecting the analog meaning of the MIDI specification. + + + + + + + The mentioned fields above don't have to be in particular order. + + Example: + + + C: "GET FILE INSTRUMENT INFO 'D:/Sounds/Foo.gig' 0" + S: "NAME: Lunatic Loops" +    "FORMAT_FAMILY: GIG" +    "FORMAT_VERSION: 3" +    "PRODUCT: The Backbone Bongo Beats" +    "ARTISTS: Jimmy the Fish" +    "." + + +
+
+
The grammar of the control protocol as descibed in @@ -6162,6 +6642,8 @@ / FORMAT SP format_instruction + / SEND SP send_instruction + / RESET / QUIT @@ -6176,8 +6658,12 @@ / DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP db_path SP filename + / DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP FILE_AS_DIR SP db_path SP filename + / DB_INSTRUMENTS SP scan_mode SP db_path SP filename + / DB_INSTRUMENTS SP scan_mode SP FILE_AS_DIR SP db_path SP filename + / DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename / DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename SP instrument_index @@ -6204,6 +6690,10 @@ / CHANNEL_COUNT + / CHANNEL_MIDI + + / DEVICE_MIDI + / VOICE_COUNT / STREAM_COUNT @@ -6256,6 +6746,10 @@ / CHANNEL_COUNT + / CHANNEL_MIDI + + / DEVICE_MIDI + / VOICE_COUNT / STREAM_COUNT @@ -6416,6 +6910,10 @@ / VOLUME + / VOICES + + / STREAMS + / FILE SP INSTRUMENTS SP filename / FILE SP INSTRUMENT SP INFO SP filename SP instrument_index @@ -6454,10 +6952,16 @@ / DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped + / DB_INSTRUMENT SP FILE_PATH SP filename SP filename + / ECHO SP boolean / VOLUME SP volume_value + / VOICES SP number + + / STREAMS SP number + create_instruction = @@ -6500,6 +7004,8 @@ / DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list + / LOST SP DB_INSTRUMENT_FILES + move_instruction = @@ -6638,6 +7144,12 @@ +send_instruction = + + CHANNEL SP MIDI_DATA SP string SP sampler_channel SP number SP number + + + load_instr_args = filename SP instrument_index SP sampler_channel @@ -6759,13 +7271,6 @@ filename = path - #if WIN32 - $$ = $1.toWindows(); - #else - - $$ = $1.toPosix(); - #endif - @@ -6902,6 +7407,11 @@ "MOVE DB_INSTRUMENT_DIRECTORY" "COPY DB_INSTRUMENT" "COPY DB_INSTRUMENT_DIRECTORY" + "FIND LOST DB_INSTRUMENT_FILES" + "SET DB_INSTRUMENT FILE_PATH" + "GET FILE INSTRUMENTS" + "LIST FILE INSTRUMENTS" + "GET FILE INSTRUMENT INFO" Note that the forward slash character ('/') has a special meaning in filename / path based arguments: it acts as separator of the nodes in @@ -6912,6 +7422,16 @@ + Note for Windows: file path arguments in LSCP are expected + to use forward slashes as directory node separator similar + to Unix based operating systems. In contrast to Unix however + a Windows typical drive character is expected to be + prefixed to the path. That is an original Windows file path + like "D:\Sounds\My.gig" would become in LSCP: + "D:/Sounds/My.gig". + + + The following LSCP commands even support escape sequences as part of at least one of their text-based arguments (i.e. entity name, description) and / or may contain escape sequences in at least one of @@ -7045,6 +7565,56 @@ of sampler channels.
+
+ Client may want to be notified when MIDI data arrive on sampler channels on + back-end side, by issuing the following command: + + + SUBSCRIBE CHANNEL_MIDI + + + Server will start sending one of the the following notification messages: + + + "NOTIFY:CHANNEL_MIDI:<channel-id> NOTE_ON <note> <velocity>" + "NOTIFY:CHANNEL_MIDI:<channel-id> NOTE_OFF <note> <velocity>" + + + where <channel-id> will be replaced by the ID of the sampler channel where the MIDI + data arrived. <note> and <velocity> are integer values in the range between + 0 .. 127, reflecting the analog meaning of the MIDI specification. + + CAUTION: no guarantee whatsoever will be made that MIDI events are actually all + delivered by this mechanism! With other words: events could be lost at any time! + This restriction was made to keep the RT-safeness of the backend's MIDI and audio + thread unaffected by this feature. +
+ +
+ Client may want to be notified when MIDI data arrive on MIDI input devices by issuing the following command: + + + SUBSCRIBE DEVICE_MIDI + + + Server will start sending one of the the following notification messages: + + + "NOTIFY:DEVICE_MIDI:<device-id> <port-id> NOTE_ON <note> <velocity>" + "NOTIFY:DEVICE_MIDI:<device-id> <port-id> NOTE_OFF <note> <velocity>" + + + where <device-id> <port-id> will be replaced + by the IDs of the respective MIDI input device and the device's MIDI port where the MIDI + data arrived. <note> and <velocity> are integer values in the range between + 0 .. 127, reflecting the analog meaning of the MIDI specification. + + CAUTION: no guarantee whatsoever will be made that MIDI events are actually all + delivered by this mechanism! With other words: events could be lost at any time! + This restriction was made to keep the RT-safeness of the backend's MIDI and audio + thread unaffected by this feature. +
+
Client may want to be notified when the number of voices on the back-end changes by issuing the following command: @@ -7298,6 +7868,18 @@ replaced by the optional dotted floating point value, reflecting the new global volume parameter. + + "NOTIFY:GLOBAL_INFO:VOICES <max-voices>" - Notifies that the + golbal limit of the sampler for maximum voices is changed, where + <max-voices> will be an integer value, reflecting the + new global voice limit parameter. + + + "NOTIFY:GLOBAL_INFO:STREAMS <max-streams>" - Notifies that the + golbal limit of the sampler for maximum disk streams is changed, where + <max-streams> will be an integer value, reflecting the + new global disk streams limit parameter. +