Previous: Installing, Up: Installation and Setup

4.2 Running

Before SPORCH can work, instrument sample sound files must be analyzed and a database of instrument spectra compiled. To do this, follow these steps:

  1. Organize all of your sound files in as many subdirectories as you want under one parent directory. These should contain samples of the instruments you're interested in at as many pitches and dynamic levels as possible. Different sample collections of the same instruments can be used—you can choose from them later. A wide variety of formats are supported (anything libsndfile can open). Sound files can contain one sample or many—it doesn't matter. The parent directory is refered to here as the “database directory.”
  2. Open a text file called conf in the database directory. Specify all of your analysis parameters here. Use the conf file in the examples section and the reference as a guide. Put more conf files in subdirectories as needed. Each one should at least contain a list subdirectories to descend into and which sound files to analyze if any, plus instructions on how to extract names, pitches and dynamic levels from filenames. Parameters in one conf file affect all analyses in that directory and its subdirectories unless overridden by the same setting in another file (in a subdirectory).

    If you have large sound files with multiple samples in them, you'll have to add a bunch of “exception” blocks to tell sporchdb how/where to look for them. Specifying exceptions prevents the need to separate larger sound files into many smaller ones. Look at the bottom of the example conf file to see how to do this.

  3. Open another file called insts in the database directory. Specify tunings and instruments in here with all of their pitch ranges and alternate techniques (if any). Use the file in the examples section and the reference as a guide.
  4. Open a file called .sporch in your home directory. Put a line like this in it:
    db-dir = /home/me/path/to/dbdir

    Next run sporchdb at the command prompt. This compiles the database and saves it under the name db in the database directory. Cache files are saved by default so that subsequent runs are faster and use the results of previous identical analyses.

  5. Use the command line program sporchq to query the database and see if it's compiled the way you expect it to be. You must have gnuplot installed to see graphs. By default, sporchq prints plain data and ASCII graphs if you select the plot option—several settings in .sporch affect how gnuplot outputs its graphs. (Unfortunately, peaks don't really look like peaks because gnuplot wants to plot them pointing downwards instead of upwards.)

    The data is normalized (by collection—see `conf' Files) so that the total amplitudes (square root of the sum of the amplitudes squared) of every instrument/pitch/dynamic level together is 1. An amplitude of 1 then represents the average amplitude for that entire collection. Peaks in a single analysis should be spaced frequency-wise (somewhat unevenly) according to the tuning system selected. Average total or maximum amplitudes over pitch and dynamic level should make sense (but may vary widely depending on the sound samples used.)

After the database has been compiled, it is relatively easy to sporchestrate using the sporch command or the library. For a simple example, find an interesting sound file and type the following:

sporch /path/to/my/sound.wav -lpeak -m0

Look at the examples section and the API reference to see how to use the program.