song_match.song

  • Note - Represents a musical note.
  • Song - Represents a song.

song_match.song.note

Module containing Note.

song_match.song.note.EIGHTH_NOTE = 0.2

Time for eighth note.

song_match.song.note.HALF_NOTE = 0.8

Time for half note.

class song_match.song.note.Note(note: str, duration: int = 0.4)[source]

Bases: object

Represents a musical note.

play() → None[source]

Play the note.

Returns:None
song_match.song.note.QUARTER_NOTE = 0.4

Time for quarter note.

song_match.song.note.WHOLE_NOTE = 1.6

Time for whole note.

song_match.song.song

Module containing Song.

class song_match.song.song.Song[source]

Bases: abc.ABC

Abstract base class for songs.

Currently only supports songs with 3 notes.

Must override 4 abstract properties:

  1. _notes - A list of 3 Note instances in ascending order by pitch.
  2. _sequence - A sequence of Note instances that make up the song.
  3. _cube_lights - A list of 3 Light instances.
  4. _difficulty_markers - A list of indices where the song ramps up in difficulty.
get_cube_id(note: song_match.song.note.Note) → int[source]

Get the Cube ID for a corresponding note.

Parameters:note – The Note of the song.
Returns:cube_id
get_cube_light(cube_id: int) → cozmo.lights.Light[source]

Get the Light for a corresponding cube.

Parameters:cube_idcube_id
Returns:Light for the corresponding cube.
get_difficulty_markers() → List[int][source]

Markers which determine at what position the song ramps up in difficulty.

There are two difficulty markers: 1. Medium 2. and Long

The game starts incrementing by 1 note at a time. Once the game reaches medium, it increments by 2 notes at a time. Once the game reaches long, it increments by 3 notes at a time.

Returns:A list of difficulty markers.
get_long_difficulty_marker() → int[source]

Get the long difficulty length marker.

Returns:Long difficulty marker.
get_medium_difficulty_marker() → int[source]

Get the medium difficulty length marker.

Returns:Medium difficulty marker.
get_note(cube_id: int) → song_match.song.note.Note[source]

Get the Note for a corresponding cube.

Parameters:cube_idcube_id
Returns:The Note of the cube.
get_sequence() → List[song_match.song.note.Note][source]

Get the sequence of notes.

Returns:A sequence of notes.
get_sequence_slice(end: int) → List[song_match.song.note.Note][source]

Get a slice of the sequence up to and including end.

Parameters:end – The end position of the sequence.
Returns:A sequence of notes up until a certain position.
is_finished(position: int) → bool[source]

Returns whether or not the song is finished based upon the position in the sequence.

Parameters:position – The position in the sequence of notes.
Returns:True if the song is finished. False otherwise.
is_not_finished(position: int) → bool[source]

Returns whether or not the song is finished based upon the position in the sequence.

Parameters:position – The position in the sequence of notes.
Returns:True if the song is not finished. False otherwise.
is_sequence_long(sequence_length: int) → bool[source]

Get whether the length of a sequence is long.

“Long” is defined as being greater than the medium difficulty marker.

Parameters:sequence_length – The length of a sequence of notes.
Returns:Whether the sequence is long
length

Property for accessing the length of the song.

Returns:The length of the song.
play_note(cube_id: int) → None[source]

Play the note for a corresponding cube.

Parameters:cube_idcube_id
Returns:None