--- linuxsampler/trunk/Documentation/lscp.xml 2007/10/12 12:35:58 1407 +++ linuxsampler/trunk/Documentation/lscp.xml 2010/10/04 12:20:23 2137 @@ -16,9 +16,9 @@ to an annoying "missing Normative/Informative References" error message --> - + - LinuxSampler Control Protocol (draft) + LinuxSampler Control Protocol @@ -34,7 +34,7 @@ schoenebeck at software minus engineering dot org - + LinuxSampler Developers LSCP @@ -2162,10 +2162,18 @@ - Example: + Example (Unix): - + C: LOAD INSTRUMENT '/home/joe/gigs/cello.gig' 0 0 + 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: @@ -3924,6 +4004,24 @@
+
+ The front-end can ask for the current number of active disk streams on + the sampler by sending the following command: + + + GET TOTAL_STREAM_COUNT + + + + Possible Answers: + + + LinuxSampler will answer by returning the number of all active + disk streams on the sampler. + + +
+
The front-end can reset the whole sampler by sending the following command: @@ -4059,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. +
+ @@ -5267,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 @@ -5312,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. @@ -5715,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"). @@ -5958,7 +6197,7 @@ FORMAT INSTRUMENTS_DB - + Possible Answers: @@ -5977,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" + + +
+ @@ -6055,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 @@ -6144,6 +6642,12 @@ / FORMAT SP format_instruction + / SEND SP send_instruction + + / APPEND SP append_instruction + + / INSERT SP insert_instruction + / RESET / QUIT @@ -6158,8 +6662,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 @@ -6172,6 +6680,8 @@ / MIDI_INSTRUMENT_MAP SP map_name + / SEND_EFFECT_CHAIN SP device_index + subscribe_event = @@ -6186,6 +6696,10 @@ / CHANNEL_COUNT + / CHANNEL_MIDI + + / DEVICE_MIDI + / VOICE_COUNT / STREAM_COUNT @@ -6218,6 +6732,8 @@ / MISCELLANEOUS + / TOTAL_STREAM_COUNT + / TOTAL_VOICE_COUNT / GLOBAL_INFO @@ -6236,6 +6752,10 @@ / CHANNEL_COUNT + / CHANNEL_MIDI + + / DEVICE_MIDI + / VOICE_COUNT / STREAM_COUNT @@ -6268,6 +6788,8 @@ / MISCELLANEOUS + / TOTAL_STREAM_COUNT + / TOTAL_VOICE_COUNT / GLOBAL_INFO @@ -6300,6 +6822,12 @@ / MIDI_INSTRUMENT_MAP SP ALL + / SEND_EFFECT_CHAIN SP device_index SP effect_chain + + / SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP chain_pos + + / FX_SEND SP SEND_EFFECT SP sampler_channel SP fx_send_id + / DB_INSTRUMENT_DIRECTORY SP FORCE SP db_path / DB_INSTRUMENT_DIRECTORY SP db_path @@ -6312,6 +6840,20 @@ AVAILABLE_ENGINES + / AVAILABLE_EFFECTS + + / EFFECT_INSTANCES + + / EFFECT SP INFO SP effect_index + + / EFFECT_INSTANCE SP INFO SP effect_instance + + / EFFECT_INSTANCE_INPUT_CONTROL SP INFO SP effect_instance SP input_control + + / SEND_EFFECT_CHAINS SP device_index + + / SEND_EFFECT_CHAIN SP INFO SP device_index SP effect_chain + / AVAILABLE_MIDI_INPUT_DRIVERS / MIDI_INPUT_DRIVER SP INFO SP string @@ -6358,6 +6900,8 @@ / SERVER SP INFO + / TOTAL_STREAM_COUNT + / TOTAL_VOICE_COUNT / TOTAL_VOICE_COUNT_MAX @@ -6392,6 +6936,14 @@ / VOLUME + / VOICES + + / STREAMS + + / FILE SP INSTRUMENTS SP filename + + / FILE SP INSTRUMENT SP INFO SP filename SP instrument_index + set_instruction = @@ -6406,6 +6958,8 @@ / MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val_list + / EFFECT_INSTANCE_INPUT_CONTROL SP VALUE SP effect_instance SP input_control SP control_value + / CHANNEL SP set_chan_instruction / MIDI_INSTRUMENT_MAP SP NAME SP midi_map SP map_name @@ -6418,6 +6972,8 @@ / FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value + / FX_SEND SP SEND_EFFECT SP sampler_channel SP fx_send_id SP effect_chain SP chain_pos + / DB_INSTRUMENT_DIRECTORY SP NAME SP db_path SP stringval_escaped / DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped @@ -6426,10 +6982,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 = @@ -6446,6 +7008,10 @@ / FX_SEND SP sampler_channel SP midi_ctrl SP fx_send_name + / EFFECT_INSTANCE SP effect_index + + / EFFECT_INSTANCE SP effect_system SP module SP effect_name + reset_instruction = @@ -6472,6 +7038,8 @@ / DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list + / LOST SP DB_INSTRUMENT_FILES + move_instruction = @@ -6498,6 +7066,8 @@ / FX_SEND SP sampler_channel SP fx_send_id + / EFFECT_INSTANCE SP number + load_instruction = @@ -6508,6 +7078,18 @@ +append_instruction = + + SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP effect_instance + + + +insert_instruction = + + SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP chain_pos SP effect_instance + + + set_chan_instruction = AUDIO_OUTPUT_DEVICE SP sampler_channel SP device_index @@ -6586,6 +7168,12 @@ / AVAILABLE_ENGINES + / AVAILABLE_EFFECTS + + / EFFECT_INSTANCES + + / SEND_EFFECT_CHAINS SP number + / AVAILABLE_MIDI_INPUT_DRIVERS / AVAILABLE_AUDIO_OUTPUT_DRIVERS @@ -6606,6 +7194,14 @@ / DB_INSTRUMENTS SP db_path + / FILE SP INSTRUMENTS SP filename + + + +send_instruction = + + CHANNEL SP MIDI_DATA SP string SP sampler_channel SP number SP number + load_instr_args = @@ -6632,6 +7228,12 @@ +effect_instance = + + number + + + device_index = number @@ -6702,6 +7304,12 @@ +control_value = + + real + + + sampler_channel = number @@ -6756,6 +7364,36 @@ +effect_name = + + stringval_escaped + + + +effect_index = + + number + + + +effect_chain = + + number + + + +chain_pos = + + number + + + +input_control = + + number + + + param_val_list = param_val @@ -6803,6 +7441,18 @@ +effect_system = + + string + + + +module = + + filename + + + @@ -6865,6 +7515,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 @@ -6875,6 +7530,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 @@ -7008,6 +7673,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: @@ -7145,6 +7860,24 @@ all currently active voices.
+
+ Client may want to be notified when the total number of disk streams on the + back-end changes by issuing the following command: + + + SUBSCRIBE TOTAL_STREAM_COUNT + + + Server will start sending the following notification messages: + + + "NOTIFY:TOTAL_STREAM_COUNT:<streams>" + + + where <streams> will be replaced by the new number of + all currently active disk streams. +
+
Client may want to be notified when the number of MIDI instrument maps on the back-end changes by issuing the following command: @@ -7243,6 +7976,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. +