Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay in cycle #29

Closed
unlessgames opened this issue Jul 5, 2024 · 3 comments
Closed

Delay in cycle #29

unlessgames opened this issue Jul 5, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@unlessgames
Copy link
Collaborator

I'd like to add a feature to the cycle to express sub-step delays.

In tidal you can combine patterns with different delaying functions to achieve swing and so on but since here there is only one pattern that determines the final events, this isn't easy to do. Hence I propose an additional operator that could delay any step inside it's own span.

Currently delays can be achieved by enclosing the step in a subdivision and prepending rests like [~~ a] b which is alright but a bit verbose and restrictive.

So instead it could be for example a\0.25 b that would be equivalent to [~ a _ _ ] b and so on. Maybe it could even be just a.25 but that might be a bit ambiguous.

It should be fairly easy to apply this when outputting events.

@unlessgames unlessgames added the enhancement New feature or request label Jul 5, 2024
@emuell
Copy link
Owner

emuell commented Jul 6, 2024

  • as new operator could also work and could probably also support fractions?

cycle("a+0.5 b c") or cycle("a+1/2 b c")


Right now delaying also is possible via map:

local delays = { 0, 1/32, 0, 1/32 }

---@param context CycleMapContext
---@param value NoteValue
local function apply_delay(context, value)
  local delay = delays[math.imod(context.step, #delays)]
  return note(value):with_delay(delay)
end

return rhythm {
  unit = "1/1",
  emit = cycle("c d# g a#"):map(apply_delay)
}

@emuell
Copy link
Owner

emuell commented Jul 8, 2024

The more generalized version of the delay mapping is now here:

https://github.com/emuell/afseq/blob/feature/cycle-mappings/types/nerdo/library/mappings.lua#L95

return rhythm {
  unit = "1/1",
  emit = cycle("c d# g a#"):map(mappings.with_delay{ 0, 1/32, 0, 1/64 })
}

@emuell
Copy link
Owner

emuell commented Jul 14, 2024

Let's continue that in #29 and #13

@emuell emuell closed this as completed Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants