Package jazzparser :: Package data :: Package db_mirrors :: Module output
[hide private]
[frames] | no frames]

Module output

source code

Output chord corpus data to a text file that others can use.

Data structures and utilities are provided elsewhere in the codebase for loading, editing, converting, saving, etc. chord sequence data with annotations. It's stored either as a sqlite database or as pickled Python object, neither of which is useful to many other people. This format is designed to be easily readable by others.

I don't currently provide any implementation of reading this file format, since all scripts take their input from an internally-used format. The description below of the file format should be enough to implement a function to read this in the language of your choice.

File format

The standard file extension to use for these file shall be jcc.

The first line is always:

JAZZPARSER CHORD CORPUS

Chord sequences are preceded by a blank line. They begin with the line:

BEGIN SEQUENCE

The lines that follow, up to the BEGIN CHORDS line, contain metadata about the sequence.

Lines between BEGIN CHORDS and END CHORDS each represent a single chord, with comma-separated fields. The fields are the following:


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Functions [hide private]
 
output_sequence_index(index, outfile)
Outputs the sequences in the sequence index to a text file.
source code
 
_write_header(index, outfile)
Writes a header to the outfile for this sequence index.
source code
 
_write_sequence(seq, index, outfile)
Writes the data for one chord sequence to the outfile.
source code
 
_write_chord(crd, outfile)
Writes a single line of data for a chord to the outfile.
source code
Variables [hide private]
  __package__ = None
hash(x)
Function Details [hide private]

output_sequence_index(index, outfile)

source code 

Outputs the sequences in the sequence index to a text file.

Parameters:
  • index (jazzparser.data.db_mirrors.SequenceIndex) - index to get sequences from
  • outfile (file-like object) - file to write to