Using the Command Line Interface |
---|
EXPLANATION OF THIS SECTION
This section of the manual explains all of the command line arguments that may be used with jSymbolic and provides usage examples.
RUNNING JSYMBOLIC GRAPHICALLY
The simplest way of using jSymbolic is to simply run the jSymbolic GUI by double clicking the jSymbolic2.jar file's icon on a graphical disk interface, such as Windows or OS X. However, a greater range of options are made available by running jSymbolic through a terminal interface using command line arguments, as described below. Also, running jSymbolic simply by double clicking its icon could, in rare cases, result in running out of memory in the case of particularly large and complex files (see below), so in such cases it may be safer to run jSymbolic from the command line.
ACCESSING JSYMBOLIC VIA A TERMINAL INTERFACE
One way of using jSymbolic is via a terminal prompt, such as a Windows DOS command prompt, or a terminal prompt on OS X, Linux, UNIX, etc. Although such a command line approach can be less intuitive for some initially relative to using the jSymbolic GUI, it can also sometimes be faster and easier. If you are unsure how to access a terminal prompt on your computer, please consult instructions for your particular operating system on-line for details on how to access and use it.
Once you have accessed a terminal prompt, navigate to the jSymbolic folder and locate the file named "jSymbolic2.jar", which is included in the jSymbolic distribution. A folder called "lib" should also be present in the same folder (it contains other .jar files jSymbolic needs to run properly). You must run this "jSymbolic2.jar" file (using the Java Runtime Environment), as shown below, in order to access jSymbolic's functionality. The particular command line arguments that you use when running jSymbolic in this way will determine exactly what jSymbolic does.
COMMAND LINE ARGUMENTS THAT INCLUDE ONE OR MORE SPACES
Note that any command line arguments you use that contain a space (such as file paths) must be fully enclosed in quotation marks, otherwise jSymbolic will not work properly. This is standard Java practice. So, for example, if one were using jSymbolic with a configuration file (see below) called "My Config File.txt", then this would NOT work:
java -Xmx6g -jar jSymbolic2.jar -configrun My Config File.txt
Instead, correct usage would be:
java -Xmx6g -jar jSymbolic2.jar -configrun "My Config File.txt"
RUNNING JSYMBOLIC WITH A SUFFICIENTLY HIGH MEMORY CEILING
By its nature, the Java Virtual Machine is always assigned a maximum amount of memory at runtime. If a specific maximum is not assigned manually at runtime, then this will be the smaller of 1/4 the computer's physical memory or 1 GB. jSymbolic's processing can sometimes require quite a bit of memory, so it is best to manually specify a large maximum when running jSymbolic just to be safe. This can be done by using the "-Xmx" flag when running Java, as shown in the examples below.
It is suggested that a maximum of six gigabytes be used, which is why "-Xmx6g" is specified below. Of course, the vast majority of processing jobs will require much, much less than this amount of memory, but it is suggested that a high maximum such as this be assigned if possible, as jSymbolic will quit processing (with an explanatory error message) if the maximum assigned memory is exceeded while processing a particularly large or complex piece of music. In the very unlikely event that an out-of-memory error does occur, jSymbolic should be rerun with a larger maximum specified.
Users are advised not to assign a greater amount of memory greater than the amount of physical memory that they have on their systems, however, as virtual memory processing can be quite slow.
RUNNING JSYMBOLIC FROM A TERMINAL INTERFACE
The simplest way to run jSymbolic from a terminal prompt is to type the following at your terminal prompt (after you have navigated to the directory containing the jSymbolic2.jar file):java -Xmx6g -jar jSymbolic2.jar
This will run the jSymbolic GUI set up with default settings.
One must add jSymbolic command line arguments if one wishes to instigate jSymbolic processing directly from the command line. Some of these command line arguments consist of flag/value pairs, where the flag comes first and is preceded with a "-". Essentially, the flag indicates the type of option, and the value indicates its particular setting.
Other command line arguments simply consist of values, with no flags, of flags with no values. For example, a lone flag of "-help" will print to the terminal a list of valid flags with explanations of what they are. This can be run as follows:
java -jar jSymbolic2.jar -help
Invalid command line arguments will also result in the list of legitimate command line arguments being printed out to the terminal.
Important General Notes:
SPEEDING UP PROCESSING BY EXTRACTING FEATURES IN PARALLEL WITH MULTIPLE INSTANCES
Although it is not yet possible to run jSymbolic feature extraction using multiple internal threads to speed up processing, if processing speed is a concern then multiple instances of jSymbolic may be spawned from separate terminal windows, and each such jSymbolic instance may be run in parallel without danger to extract features from separate portions of a large dataset. This is rarely necessary in practice, however, since jSymbolic is generally quite fast when even just a single instance is used.
JSYMBOLIC'S COMMAND LINE ARGUMENTS (WITH NO NON-DEFAULT CONFIGURATION FILE SPECIFIED)
java -jar jSymbolic2.jar -help
Outputs valid command line arguments.
java -Xmx6g -jar jSymbolic2.jar
Runs the jSymbolic GUI using default settings pre-loaded.
java -Xmx6g -jar jSymbolic2.jar <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath>
Extracts features using default settings from the symbolic music file as a whole at the path specified by SymbolicMusicFileOrDirectoryInputPath, and saves the extracted features as an ACE XML 1.1 Features Values File to the path specified by AceXmlFeatureValuesOutputPath. An ACE XML Feature Definitions File is also saved to the path specified by AceXmlFeatureDefinitionsOutputPath. Note that SymbolicMusicFileOrDirectoryInputPath may alternatively be a directory, in which case jSymbolic extracts features from the symbolic music files with recognized extentions that it (and its recursively searched sub-directrories) contain. Since no configuration settings file is specified, jSymbolic first checks for a configurations file in the jSymbolic home directory with the default jSymbolicDefaultConfigs.txt file name. If it exists, and it does not specify input or output paths, then feature extraction occurs under its settings. If it does not exist, or if it specifies input or output paths, then feature extraction occurs under default settings.
java -Xmx6g -jar jSymbolic2.jar -window <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath> <WindowLength> <WindowOverlapFraction>
Processing here is similar to the above case, but now the input file is broken into a series of windows, and features are extracted from each of these windows separately. Each window is of equal temporal duration except for the last, which will have a duration corrsponding to the amount of remaining time in the piece. The features extracted from each of these windows are stored separately in a single output ACEM XML Feature Values file. The WindowLength value specifies the duration of each window in seconds. The WindowOverlapFraction value (which should have a value of 0 (for no overlap) or above and below 1) specifies the amount of overlap between consecutive windows. For example, for a WindowLength value of 10 and a WindowOverlapFraction value of 0.1, the windows will be from 0 sec to 10 sec, 9 sec to 19 sec, etc. Since no configuration settings file is specified, feature extraction occurs under default settings (aside from windowing, of course). Note that under these settings, even if a valid default jSymbolicDefaultConfigs.txt file exists, it is still ignored.
java -Xmx6g -jar jSymbolic2.jar -arff <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath>
java -Xmx6g -jar jSymbolic2.jar -arff -window <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath> <WindowLength> <WindowOverlapFraction>
The -arff switch can be added to save features as Weka ARFF files (in addition to saving them as ACE XML files). The ARFF file is saved with the same name as the <AceXmlFeatureValuesOutputPath> file, but with the extension changed to ".arff". Note that this can be coupled with the -csv switch explained below as well. Note that under these settings, even if a valid default jSymbolicDefaultConfigs.txt file exists, it is still ignored.
java -Xmx6g -jar jSymbolic2.jar -csv <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath>
java -Xmx6g -jar jSymbolic2.jar -csv -window <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath> <WindowLength> <WindowOverlapFraction>
The -csv switch can be added to save features as CSV text files (in addition to saving them as ACE XML files). The CSV file is saved with the same name as the <AceXmlFeatureValuesOutputPath> file, but with the extension changed to ".csv". Note that this can be coupled with the -arff switch explained above as well. Note that under these settings, even if a valid default jSymbolicDefaultConfigs.txt file exists, it is still ignored.
java -Xmx6g -jar jSymbolic2.jar -consistencycheck <MidiOrMeiOrDirectoryPath>
Outputs reports on whether or not certain musical characteristics are consistent within and across all MIDI and MEI files with recognized extensions that are found within the specified directory (and its recursively searched sub-directories), both across the files as a group and internally within each file. Files must have a proper MIDI or MEI file extension to be included in this processing. A single file may alternatively be specified, in which case that file will just be checked for self-consistency. Either way, MEI files are converted to MIDI as part of this processing. If multiple files are found, then the generated reports will include: a brief report on the contents of each file and its self-consistency; a summary of self-inconsistencies found in the files (e.g. multiple tempos in a single file); and a report of the inconsistencies found across files (e.g. different tempos found in different files). Note that this does not involve feature extraction; it is instead a tool for helping to avoid dataset bias and aid testing and debugging during feature development.
java -Xmx6g -jar jSymbolic2.jar -mididump <MidiOrMeiOrDirectoryPath>
Outputs reports about the specified MIDI or MEI file and each of the MIDI messages contained in it (MEI files are converted to MIDI as part of this processing). A directory may alternatively be specified, in which case the contents of each MIDI or MEI file with recognized extensions that it (and its recursively searched sub-directories) contain will be reported one-by-one. Files must have a proper MIDI or MEI file extension to be included in this processing. Reports include formatted and aggregated details of all relevant MIDI messages found in each file (or, in the case of MEI files, the MIDI messages corresponding to the contents of each such file). Note that this does not involve feature extraction; it is instead a tool for helping to avoid dataset bias and aid testing and debugging during feature development.
JSYMBOLIC'S COMMAND LINE ARGUMENTS (WITH A NON-DEFAULT CONFIGURATION FILE SPECIFIED)
The following command line arguments can be used together with a jSymbolic configuration settings file:
java -Xmx6g -jar jSymbolic2.jar -configgui <ConfigurationFilePath>
Runs the jSybmolic GUI with settings specified by the configuration file at the path specified by the ConfigurationFilePath value. An error message is printed to the terminal and execution terminated if this file is invalid or does not exist.
java -Xmx6g -jar jSymbolic2.jar -configrun <ConfigurationFilePath>
Runs jSymbolic directly (does not run the GUI) using the settings specified by the configuration file at the path specified by the ConfigurationFilePath value. This configuration file must specify the input and output paths to use. An error message is printed to the terminal and execution terminated if this file is invalid or does not exist.
java -Xmx6g -jar jSymbolic2.jar -configrun <ConfigurationFilePath> <SymbolicMusicFileOrDirectoryInputPath> <AceXmlFeatureValuesOutputPath> <AceXmlFeatureDefinitionsOutputPath>
As in the above example, runs jSymbolic directly (does not run the GUI) using the settings specified by the configuration file at the path specified by the ConfigurationFilePath value. However, unlike the above example, the input and output paths must not be specified in the configuration settings file, and are instead specified directly in the provided command line arguments. An error message is printed to the terminal and execution terminated if this file is invalid or does not exist.
java -Xmx6g -jar jSymbolic2.jar -validateconfigallheaders <ConfigurationFilePath>
Check the configuration file at the specified ConfigurationFilePath path to see if it is valid and complete. In this case, it must specify both output files and input files in order to be considered valid. Results are output to the terminal.
java -Xmx6g -jar jSymbolic2.jar -validateconfigfeatureoption <ConfigurationFilePath>
Check the configuration file at the specified ConfigurationFilePath path to see if it is valid and complete. In this case, it may specify neither output files nor input files in order to be considered valid. Results are output to the terminal.
USAGE EXAMPLES
These examples demonstrate a few sample ways that jSymbolic can be run from the command line. These examples all make use of the command line flags and values explained above.
Example 1: Run the jSymbolic GUI under default settings.
java -Xmx6g -jar jSymbolic2.jarExample 2: Extract features from a single music file called "test.mid" in the current directory, and output the results to "feature_values_1.xml", "feature_values_1.csv" and "feature_descriptions_1.xml", to be created in the current directory.
java -Xmx6g -jar jSymbolic2.jar -csv ./test.mid ./feature_values_1.xml ./feature_descriptions_1.xmlExample 3: Extract features from all symbolic feature files in the directory called "test" (and its recursively searched sub-directories) with recognized extentions, and output the results to "feature_values_1.xml", "feature_values_1.csv" and "feature_descriptions_1.xml" files, to be created in the current directory.
java -Xmx6g -jar jSymbolic2.jar -csv ./test/ ./feature_values_1.xml ./feature_descriptions_1.xmlExample 4: Extract features from all symbolic feature files in the directory called "test" (and its recursively searched sub-directories) with recognized extensions, and output the results to "feature_values_1.xml" and "feature_descriptions_1.xml" files, to be created in the current directory. A window size of 10 seconds will be used with an overlap fraction of 0.1 (i.e. 1 second, in this case).
java -Xmx6g -jar jSymbolic2.jar -window ./test/ ./feature_values_1.xml ./feature_descriptions_1.xml 10 0.1Example 5: Extract features from a single music file called "test.mid" in the current directory, and output the results to "feature_values_1.xml" and "feature_descriptions_1.xml", to be created in the current directory. Also output the extracted feature values in the form of a CSV file and an ARFF file, saved in the current directory as as "feature_values_1.csv" and "feature_values_1.arff", respectively.
java -Xmx6g -jar jSymbolic2.jar -arff -csv ./test.mid ./feature_values_1.xml ./feature_descriptions_1.xmlExample 6: Extract features from all symbolic feature files in the directory called "test" (and its recursively searched sub-directories) with recognized extensions, and output the results to "feature_values_1.xml" and "feature_descriptions_1.xml" files, to be created in the current directory. The feature extraction is done using the configuration settings specified in the configuration file called "jsymbolic_configurations.txt" found in the current directory (and which should not itself specify input and output file paths).
java -Xmx6g -jar jSymbolic2.jar -configrun ./jsymbolic_configurations.txt ./test/ ./feature_values_1.xml ./feature_descriptions_1.xmlExample 7: Extract features from all symbolic files referred to in the configurations file called "jsymbolic_configurations.txt", using the output paths and settings specified in this configuration file.
java -Xmx6g -jar jSymbolic2.jar -configrun ./jsymbolic_configurations.txtExample 8: Run the jSymbolic GUI pre-loaded with the settings (including, optionally, input and output paths) specified in the configuration file called "jsymbolic_configurations.txt" in the current directory.
java -Xmx6g -jar jSymbolic2.jar -configgui ./jsymbolic_configuration.txtExample 9: Display detailed intraconsistency and interconsistency reports on all MIDI and MEI files with recognized extentions that are found in the "TestingFolder" directory (and its recursively searched sub-directories).
java -Xmx6g -jar jSymbolic2.jar -consistencycheck ./TestingFolderExample 10: Display a detailed report on the MIDI file called "test.mid" in the current directory, including a breakdown of the MIDI messages it contains.
java -Xmx6g -jar jSymbolic2.jar -mididump ./test.mid