Previous: `insts' File Example, Up: Database Configuration Files Example


8.2.2 `conf' Files Example

Only one conf file is needed to make the sample database. It tells sporchdb to descend into all (non-hidden) directories and search for all files ending in .wav.

# -*- Conf -*-
# sample SPORCH analysis file

# -----------------------------------------------------------------------------
# one of these must appear (as `conf' by default) in every directory containing 
# sound files to analyze.  instrument sound samples can be organized in any way 
# as long as they're in a single directory tree (symlinks can be used if
# necessary

# parameters apply to the currnt directory and all subdirectories unless 
# overridden by settings in a directory (exceptions are lists of files and 
# directories).  some parameters can be "turned off" by specifying `none' (see
# the manual)

# there should also be an instrument definition (`inst' by default) file in the 
# root sound file directory that tells sporchdb how to compile the analysis 
# information into a database file

# after you define all the settings, put a line like `db-dir = 
# /home/myuserid/some/directory/sporchdb' in a file called `.sporch' in your 
# home directory and type `sporchdb' at the command prompt.  if everything goes 
# smoothly, the database will be compiled and saved in a file called `db' in 
# the root sound file directory.  by default, sporchdb saves a cache for each 
# sound file so adding another directory or tuning to the database doesn't take
# a long time.  the cache files are always used unless an important setting has
# been changed or the sound file has been modified.  sporchdb can also be 
# safely terminated with control-C or the `kill' or `killall' commands

# -----------------------------------------------------------------------------


# comment
// another comment
/* one more...
   comment */

# "a string"
# 'another string'
# yet_another_string
# "string with \"quotes\""
# "string \\ with \\ backslashes"
# quoteless\ string\ with\ spaces

# descend into all directories ("[^\\.].*" is a regular expression)
dirs = "[^\\.].*" 
# this could also be a list of regular expressions, like this:
/*
dirs = ("dirs_.*" "other_dirs_.*" "violin")
*/
# specifies which files are the sound files to analyze--use double-backslashes 
# inside quotes.  sporch can open whatever libsndfile can open
/*
files = ".*\\.aiff"
*/

# -----------------------------------------------------------------------------
# parameters


# these settings were used to build the sample database.  ones appearing 
# between /* and */ are settings that are commented out

# collections, models, tuning systems:

# defines an id string (case insensitive) to identify these as belonging to one
# "collection" (in this case, the University of Iowa instrument samples)
coll = "iowa"
# individual instrument models can also be specified.  this is like specifying 
# a collection within a collection.  unique values are necessary to insure that 
# sporchdb doesn't select only one peak analysis for each
# instrument/pitch/dynamic level
/*
model = "steinway piano"
*/

# specifies a tuning id here so that sporchdb knows how to interpret 
# pitch-related parameters.  this shouldn't be necessary unless you have 
# microtonal instrument samples.  tuning systems are defined in the `insts' 
# file
/*
default-tune = 19-tonesperoct
*/

# this is an integer from 0 to 100 that functions as a "preference value."  
# sporch always uses the collection and model with the highest preference value 
# unless the user indicates otherwise.  if `prefs' is used, it should appear 
# along with `coll' and `model'.  if `prefs' isn't used or is only used for 
# some collections/models, sporchdb orders the remaining analyses based on how 
# close they are to their neighbors (so the "smoothest" data in terms of pitch 
# and dynamic level is selected).
/*
pref = 50
*/

# analysis id:

# regular expression to extract an id string from the filename (this id should 
# also appear in the `inst' file--sporchdb uses it to identify analyses and 
# collect them under one instrument and technique).  the subexpression is the 
# id.  also, these are the only strings that are actually case sensitive
id-parse = "([a-z]+)_.*"
# can also simply specify the id like this:
/*
id = "piano"
*/

# pitch number:

# pitches can be specified explicitly or extracted from source sound filenames. 
# for the parameters below, a string indicates a regular expressions for 
# extracting a number and a list of strings indicates matches that return their
# positions in the list if they match (the first match resolves to the number 
# 0, the second to 1, etc.).

# the octave, pitch class (or "letter" here) and microtone can be extracted 
# separately and assembled to get the pitch number

# regular expression to extract the octave number from the filename (the 
# subexpression is expected to be a number identifying the octave).  this 
# number is multiplied by 12 (or the number of pitches per octave specified by 
# the tuning) to get the base octave pitch.  some adjustment is probably 
# necessary--the `pitch-plus' setting below is set to 12 to adjust the final 
# pitch to the correct MIDI number
pitch-oct-parse = ".*_[A-G][bs]?([0-9])\\.wav"
# a list of regular expressions to extract the pitch `letter'.  the default 
# tuning here is 12-tone equal temperament so there are twelve regular 
# expressions in the list.  zero-length expressions are no-matches.  the first 
# correct match in the list determines the base pitch within the octave
pitch-let-parse = (
	".*_C[bs]?[0-9]\\.wav"
	""
	".*_D[bs]?[0-9]\\.wav"
	""
	".*_E[bs]?[0-9]\\.wav"
	".*_F[bs]?[0-9]\\.wav"
	""
	".*_G[bs]?[0-9]\\.wav"
	""
	".*_A[bs]?[0-9]\\.wav"
	""
	".*_B[bs]?[0-9]\\.wav")
# this works the same way--the first match determines the adjustment made to 
# the final pitch.  unlike the other regular epression lists, the middle one 
# resolves to the number 0 while the first resolves to -1 and the last to 1.  
# In other tuning systems, the size of this list increases to include all of 
# the necessary accidentals (for example, quarter tone tuning would contain 
# seven regular expressions ranging from -3/2 to 3/2 in 1/2 increments)
pitch-acc-parse = (
	".*_[A-G]b[0-9]\\.wav"
	".*_[A-G][0-9]\\.wav"
	".*_[A-G]s[0-9]\\.wav")
# a number (integer or floating point) to add to the final result
pitch-plus = 12
# other ways of specifying pitch and pitch components:
/*
pitch = 60
pitch = 60.5
pitch-parse = ".*samp([0-9]+)\\.wav"
pitch-oct = 4
pitch-let = 0
pitch-mic-parse = ".*_[A-G]([0-1]+)[bs]?([0-9])\\.wav"
*/
# etc...

# dynamic level:

# this resolves to a number indicating the dynamic level.  the total number of 
# levels is specified in the `insts' file using the `n-dyns' parameter.  since 
# only three levels exist in the sound samples, information for levels 1 and 3 
# are "missing" and are automatically interpolated
dyn-parse = (
	".*_pp_.*\\.wav"
	""
	".*_mf_.*\\.wav"
	""
	".*_ff_.*\\.wav")
# can also specify explicitly:
/*
dyn = 3
*/
# final adjustment if needed:
/*
dyn-plus = 1
*/

# analysis location:
# this is where the fft window (or the first one, if more than one is specified
# with `fft-n') is centered in the analysis sound file.  time values are all in 
# seconds

# segments of a larger file can be specified using these two parameters.  if 
# these next two settings are uncommented and `loc = peak' is specified like it
# is below, sporchdb looks for the highest amplitude point between 1 and 2 
# secs. into the file.  if left commented, they default to the beginning and 
# end of the file.  these can be turned off with `none'
/*
off1 = 1
off2 = 2
*/
# another way of specifying the same thing
/*
off1 = 1
dur = 1
*/
# the base analysis location (options are begin, middle, end and peak)--this is
# relative to `off1' and `off2' or `dur' if they are given 
loc = peak
# offset from the base location (if specifying `loc = peak', the small value
# here moves the analaysis point to 0.2 seconds just after the attack)
off = 0.2

# fft parameters:

# the size of the fft.  a floating point number indicates to choose the next 
# largest power of 2 (or whatever is specified with `fft-pow-limit') than the
# number of frames in that many seconds of the sound file (the fft size
# changes, then, for different sample rates).  an integer simply specifies a 
# fixed fft size
fft-size = 0.5
# indicates the total number of fft analyses to take
fft-n = 100
# the 100 fft's above are taken in equal offset increments over half a second
# (specifed here by the 0.5)
fft-span = 0.5
# 10 fft analyses are selected from the total number and averaged together to 
# get the final fft for peak extraction
fft-ave = 10

# tweaks

# indicates that the result should be tuned to the proper pitch (necessary for 
# sound samples that are out of tune).  an integer indicates the number of 
# harmonics to use for tuning (only the fundamental is used in this case).  can
# be turned off with `none'
tune-to-pitch = 1
# indicates a further tuning adjustment in cents
/*
tune = -50
*/
# specifies a minimum threshold for extracting peaks (this is mandatory and 
# defaults to -120 dB)
/*
thresh = -90
*/
# amplify the fft results by some dB value (happens immediately after fft 
# results and before peak extraction--this is set to 30 dB since the Iowa 
# samples are recorded at low levels)
amp = 30

# -----------------------------------------------------------------------------
# parameters begin here


# this is a good place to put the `off1' and `off2' parameters for individual 
# sound samples if they are stored in large sound files

# specify exceptions inside braces like this (sporchdb pretends that it's 
# descending into a subdirectory--put any exceptions to the parameters above 
# inside the braces).  the files specified here are removed from the list of 
# files specified in the `files' setting above so that they are only analyzed
# according to the settings here.  also, each exception gets a separate
# analysis cache
/*
{
# another regular expression or list of expressions
files = "violin_mf_A3-A4.wav"
pitch = 57
off1 = 1.25
off2 = 3
}

{
files = "violin_mf_A3-A4.wav"
pitch = 58
off1 = 3
off2 = 5.75
}
*/