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

:tempo key #30

Open
ntrocado opened this issue Mar 12, 2022 · 1 comment
Open

:tempo key #30

ntrocado opened this issue Mar 12, 2022 · 1 comment

Comments

@ntrocado
Copy link
Contributor

From the documentation on special keys I got the impression that the following should work, but it doesn't:

(pb :foo
  :midinote 60
  :tempo 140/60)

The tempo is unchanged... Having each pb in its own tempo would be great, is it possible?

@defaultxr
Copy link
Owner

Hmm, it looks like you're right, the :tempo key doesn't actually change the tempo of the clock, despite what the documentation says. I'm currently planning and in the process of reworking the backend and clock parts of the library, and I will probably fix this bug as part of those changes once they're ready. For now I've added a test to the suite to test for this behavior so I don't forget, and I'll also leave this issue open until then.

As for having each pattern in its own tempo, I don't think that would be directly possible, since tempo is a property of the clock, not a property of the pattern. The :tempo key is basically just meant as a possibly-more-convenient way to adjust the tempo from within a pattern, not to specify a per-pattern tempo.

That said, it should be possible to achieve basically the same effect by adjusting the :dur of each pattern. For example, if you want one pattern to play as if it were at 140BPM, regardless of the tempo of the *clock*, you can specify a :dur like the following for its last key:

(pb :foo
  :midinote 60
  :dur (pf (* (freq-dur 140/60)
              (e :dur))))

As long as that :dur is the last duration key in the pb, any previous duration information will be multiplied by the correct amount to "tempo shift" the pattern to the desired tempo, even though the tempo of the clock is not actually changing. It should also remain correct even if you do actually change the tempo of the clock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants