simfile.notes

Note data classes, plus submodules that operate on note data.

Submodules

Package Contents

Classes

NoteType

Known note types supported by StepMania.

Note

A note, corresponding to a nonzero character in a chart’s note data.

NoteData

Wrapper for note data with iteration & serialization capabilities.

class simfile.notes.NoteType

Bases: enum.Enum

Known note types supported by StepMania.

TAP = 1
HOLD_HEAD = 2
TAIL = 3
ROLL_HEAD = 4
ATTACK = A
FAKE = F
KEYSOUND = K
LIFT = L
MINE = M
class simfile.notes.Note

Bases: NamedTuple

A note, corresponding to a nonzero character in a chart’s note data.

Note objects are intrinsically ordered according to their position in the underlying note data: that is, if note1 would appear earlier in the note data string than note2, then note1 < note2 is true.

beat :simfile.timing.Beat
column :int
note_type :NoteType
player :int = 0

Only used in routine charts. The second player’s note data will have this value set to 1.

keysound_index :Optional[int]

Only used in keysounded SSC charts. Notes followed by a number in square brackets will have this value set to the bracketed number.

class simfile.notes.NoteData(source: Union[str, simfile.types.Chart, NoteData])

Wrapper for note data with iteration & serialization capabilities.

The constructor accepts a string of note data, any Chart, or another NoteData instance.

property columns(self)

How many note columns this chart has.

classmethod from_notes(cls: Type[NoteData], notes: Iterable[Note], columns: int)NoteData

Convert a stream of notes into note data.

This method assumes the following preconditions:

  • The input notes are naturally sorted.

  • Every note’s beat is nonnegative.

  • Every note’s column is nonnegative and less than columns.

Note that this method doesn’t quantize beats to 192nd ticks, and off-grid notes may result in measures with more rows than the StepMania editor would produce. StepMania will quantize these notes gracefully during gameplay, but you can apply Beat.round_to_tick() to each note’s beat if you’d prefer to keep the note data tidy.