musical-style-recognition.net

Contents
Powered by
CMSimple
Home > Software > prekern

prekern

prekern was written to assist with the translation of the scores into **kern files. Actually it's a preprocessor for **kern. It adds some context-dependency to the symbols. prekern takes a file with a single spine in context-dependent notation as input and outputs a file with the spine in **kern format.

prekern translates line after line into **kern format. The information that is not explicitly entered is "inherited" from the previous line.

The following rules are applied:

  • A line with "**prekern" will be translated into a line with "**kern".
  • A line starting with '!', '*' or '=' will just be copied.
  • A line starting with '%' will be copied without the leading '%'. Thus you can escape from the converting mechanism.
  • If the pitch is preceded by a '@', the nomal **kern interpretation is used to determine the octave. This should be used for the first note in the spine.
  • If for a certain note the duration is not provided, the duration of the preceding note is used.
  • If for a certain note the octave information is not provided, the note is chosen that is nearest to the previous note (i.e. within a fifth).
  • If a note is a fifth or more from the previous note, either '@' followed by the normal **kern representation or one of the signs '>' (take an octave higher) and '<' (take an octave lower) should be used.
  • The canonical order of **kern signifiers must be used.

An example to make things clear:

input: example.pkoutput: example.krn
**prekern
*MM76
*k[b-]
*M4/4
=1
4@cc
d
e
8f
g
=2
2a<
16b-
c
d
e
%16FFF
g
a
d<
=3
4@DD
e
f @G @b-
e a c
==
*-
**kern
*MM76
*k[b-]
*M4/4
=1
4cc
4dd
4ee
8ff
8gg
=2
2a
16b-
16cc
16dd
16ee
16FFF
16gg
16aa
16dd
=3
4DD
4EE
4FF 4G 4b-
4EE 4A 4cc
==
*-

Download

  • C++ code: prekern.cc
  • Header file: prekern.h
  • Linux Binary: prekern (built on a GNU/Linux Mandrake 9.2 system)
  • Windows Binary: prekern.exe (built under cygwin with 'g++ -mno-cygwin -o prekern -s prekern.cc' so no cygwin dll is needed.)

To compile, put prekern.cc and prekern.h in the same directory and enter something like:

g++ -o prekern prekern.cc
on the command line, if you're using the GNU Compiler Collection. With other compilers, you're on your own.

I provide this because it is helpful for me and it might be helpful for others. It is not under active development. Prekern is released under the GPL.