Skip to content

Wrong definition of onsets #483

@nichtich

Description

@nichtich

The definition and implementation of RhythmPattern.onsets looks wrong to me:

  1. the function does not take onsets but durations
  2. it has an off-by-one error: adding duration 1 to a rhythm should add one pulse instead of a pause plus a pulse. Adding duration zero should not add anything.

Current implementation:

RhythmPattern.onsets(1, 2, 2, 1); // => [1, 0, 1, 0, 0, 1, 0, 0, 1, 0]

I recommend to add function durations and change function onsets to use positions in the ryhtm:

Expected implementation:

RhythmPattern.durations(1, 2, 2, 1); // => [1, 1, 0, 1, 0, 1]
RhythmPattern.onsets(1, 3, 6, 9); // => [1, 0, 1, 0, 0, 1, 0, 0, 1, 0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions