Package jazzparser :: Package data :: Package corpora :: Module temperley :: Class DataSequence
[hide private]
[frames] | no frames]

Class DataSequence

source code

object --+
         |
        DataSequence

Data structure to store a list of events read in from a corpus file.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
add_event(self, event) source code
 
__get_events(self) source code
 
get_events_by_type(self, type)
Returns a list of all events of a specific type.
source code
 
get_grouped_events(self)
Returns a list of all events, grouped by their event type, with the event types in the order they were found in the input.
source code
 
to_lines(self)
Returns a list of lines suitable for outputing to a file.
source code
 
__str__(self)
str(x)
source code
 
__iter__(self) source code
 
to_midi(self)
Constructs a MIDI EventStream from the data in this stream.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
from_file(infile)
Creates a new DataSequence to represent the data in a file.
source code
Properties [hide private]
  events

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

get_grouped_events(self)

source code 

Returns a list of all events, grouped by their event type, with the event types in the order they were found in the input.

This should provide a form suitable for outputing to the lines of a file (using to_line() on each event). Alternatively, just use to_lines().

from_file(infile)
Static Method

source code 

Creates a new DataSequence to represent the data in a file.

Parameters:
  • infile (str or open file object) - filename or file object. Filename may be the path to the file or the path within the corpus.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

to_midi(self)

source code 

Constructs a MIDI EventStream from the data in this stream. This can then be output to a file to be played.

Note that TPCNotes will be output as normal MIDI notes. We can't do anything of the clever tuning stuff that we can do with tonal space coordinates, since we'd need to do a further step of analysis to work out the fully specified TS point from the pitch class.


Property Details [hide private]

events

Get Method:
__get_events(self)