Skip to content

Mapping/overriding note properties in cycle:map #84

Description

@unlessgames

I'd like to be able to somehow access the note properties when remapping events in cycle to make relative changes but I don't think there is a way (beside maybe writing a custom parser for value, but that doesn't sound right).

I feel like something similar to this should work

return cycle("a:#2"):map(function(context, value)
  local n = note(value)
  if n.notes[1] and n.notes[1].instrument then
    return n:instrument(n.notes[1].instrument + 1)
  else
    return n
  end
end)

even nicer would be to have mapping functions for properties that would unwrap the nil for you and pass in the instrument etc.

return cycle("a:#2"):map(function(context, value)
  -- supply a function to instrument to map it
  return note(value):instrument(function(i) return i + 1 end)
end)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions