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

Add global cycle pos cmds and show it in gui #26

Merged
merged 1 commit into from
Jun 17, 2023

Conversation

sebageek
Copy link
Contributor

@sebageek sebageek commented Oct 15, 2021

This commit adds the commands "global_cycle_len" and "global_cycle_pos"
to sooperlooper and a gui element showing the position in the current
sooperlooper cycle. This feature only works in Internal or Jack sync
mode with quantize set to cycle or 8th (i.e. whenever sooperlooper
actually has an internal cycle).

When recording the first loop in sync internal + quantize cycle + first
loop on sync it is hard to hit the first note at the beginning of the
cycle. A visual indicator of where we are in the cycle helps to be on
time in situation where no other cue is available.

The gui element has currently no text and only displays the current
cycle if its length is >= 1s. Both of these measures have been taken to
reduce visual noise in the gui.


Soo, I've been having this problem with not knowing where in the sooperlooper cycle I was when I wanted to record my first loop, so I decided to make it visible. Display is done with a SliderBar, which I think is quite neat for displaying this (..or it's the best widget I've found on short notice to do the job). I hope this is useful to someone else as well.

This is my first deep dive into the sooperlooper source and I tried to orient myself a bit on the code surrounding my changes. Also, if you think the new widget in the top bar creates too much visual noise here's a couple things we could still implement:

  • hide the widget when we're not in sync mode jack/internal and when the global cycle is shorter than 1s
  • make display of this widget configurable via preferences

Though I had some trouble with hiding/displaying that widget. Reviews / comments welcome! ;)

@ericfont
Copy link
Contributor

I'm trying out. My suggestion would be that instead of displaying a new widget, what about if the button for "quantize" instead becomes this display when the button is set to "cycle". Just my two cents.

@essej
Copy link
Owner

essej commented Oct 18, 2021

Since these are global values, you shouldn't have them be part of the per-loop state... instead add them to the global parameters /get OSC api (and from the GUI use get_global_value() and is_global_updated(), etc. As for the UI element itself... Eric may have the right idea to try to overlay the indicator with another control like "sync to" or "quantize", even though that is obviously more work...

@sebageek
Copy link
Contributor Author

I'll take a look at putting this into the global values. My first attempt of this did not work, but it might be because I haven't properly requested updates in the GUI.

Regarding the GUI element.... I like the idea as well, though the quantize box is a ChoiceBox and doesn't have the relevant indicator code that SliderBar has. I don't think I can make it a SliderBar. I could try to port the indicator code to ChoiceBox if that would be an OK use-case.

@sebageek sebageek force-pushed the global-cycle-pos branch 2 times, most recently from 8c84e46 to b622663 Compare October 19, 2021 23:55
@sebageek
Copy link
Contributor Author

I taught the ChoiceBox how to draw a bar! The interface is far less sophisticated in comparison to the SliderBar (it only displays values between 0.0 and 1.0, no indicator and all of that), but it does the trick (I think in this case it even looks better without the indicator).

image

@essej could you take a look at the code in the second commit (b622663) and see if the changes in it are acceptable to you? If they are I'd go ahead, squash the two commits and remove the extra SliderBar I added for the cycle in the first commit.

@ericfont
Copy link
Contributor

@sebageek I'm trying your latest branch (at b622663) but I don't see any animations in the quantize box like you apparently show in your screenshot.

@sebageek
Copy link
Contributor Author

@ericfont what are your settings for sync to, tempo, and quantize?

@ericfont
Copy link
Contributor

Let me start my computer up, but what settings should i use?

@sebageek
Copy link
Contributor Author

Try the settings from the screenshot. Sync to internal, 120bpm, 32 8th/cycle and quantize cycle. Anything with sync to internal that results in a cycle longer than 1s should work though.

@ericfont
Copy link
Contributor

I'm confused because when I first start your branch fresh, it looks like:

image

I don't think I'm supposed to see that curr cycle box in the top right.

@ericfont
Copy link
Contributor

oh but it seems to work with those settings your provided me. Though I think now the curr. cycle box in the ttop right is no longer necessary since you got the quantize box working with animation.

@ericfont
Copy link
Contributor

I notice that on 120bpm, if I set 8th/cycle to 4.0 the display work, but if I reduce 8th/cycle to 3.0 then there is no animation. So maybe the reason I didn't animation before was because I just had the setting below 4.0 earlier.

@sebageek
Copy link
Contributor Author

As written in #26 (comment) I first wanted to ask if that API change looks right before I remove the other commit, but on the other hand... I can just prepare the commit in the way it's meant to be merged later.

@sebageek
Copy link
Contributor Author

sebageek commented Oct 20, 2021

I notice that on 120bpm, if I set 8th/cycle to 4.0 the display work, but if I reduce 8th/cycle to 3.0 then there is no animation.

Yes, there is a limit in the code here. I only display the status if the global cycle is >= 1s, as for less than a second it just creates visual noise and is not really helpful. If you want try it out! Just comment out that one if and it should give you a very fast animation. :)

@ericfont
Copy link
Contributor

ok.

I'm making a note that when on 60 bpm, I can set 8th/cycle to 2.0 and the animation works, but not if I reduce to 1.0.

Though if go down to 30 bpm, then 8ths cycle of 1.0 works.

@essej
Copy link
Owner

essej commented Oct 20, 2021

I taught the ChoiceBox how to draw a bar! The interface is far less sophisticated in comparison to the SliderBar (it only displays values between 0.0 and 1.0, no indicator and all of that), but it does the trick (I think in this case it even looks better without the indicator).

image

@essej could you take a look at the code in the second commit (b622663) and see if the changes in it are acceptable to you? If they are I'd go ahead, squash the two commits and remove the extra SliderBar I added for the cycle in the first commit.

Very cool... go for it!

@ericfont
Copy link
Contributor

well I've commented out that if and see that the the bar looks more chaotic cause it updates the bar in seemingly random points of completion that it is hard to tell the bar is completing. I'm personally am not bothered by that noise when it is just in the quantize cycle box, though the green outline of the curr. cycle box is more distracting.

@ericfont
Copy link
Contributor

ericfont commented Oct 20, 2021

I'm noticing funny behavior which is a separate issue, but when I have tempo at 59 bpm or lower, then pressing the up/down control on the tempo box causes the number in 8th/cycle to double, thus easily reaching astronomical values. ...reported as new issue #30

This commit adds the commands "global_cycle_len" and "global_cycle_pos"
to sooperlooper. The current cycle position is displayed as a bar in the
quantize GUI element. This feature only works with Internal sync at the
moment, as this is the only case where sooperlooper has an internal
cycle pos (JackSync has a cycle length, but no position). Quantize has
to be set to cycle or 8th. The current cycle is only displayed when it
is >= 1s to avoid having too much visual noise in the GUI.

When recording the first loop in sync internal + quantize cycle + first
loop on sync it is hard to hit the first note at the beginning of the
cycle. A visual indicator of where we are in the cycle helps to be on
time in situations where no other cue is available.

ChoiceBox has been augmented with the feature to draw a bar in its
background. It is similar to what SliderBar can do but has less options
(e.g. it only displays values from 0.0f to 1.0f, no value text
rendering).
@sebageek
Copy link
Contributor Author

Okay, squashed the commits and rewrote the commit message a bit so it reflects the current state + the ChoiceBox API change.
I also tested this again with sync to Jack, where this feature doesn't work. That is most likely because sooperlooper just listens to the sync/start event on Jack. We could also display this cycle by measuring time between two sync events, but I think that is something for a future PR. I also write into the commit message that it only works with internal sync for now.

@ericfont
Copy link
Contributor

tried lastest out and look nice now.

(I'm just making an observation that the tap button seems to flash up to 239 bpm but at 240 bpm and above it doesn't flash...so seems that a similar decision to avoid chaotic visual noise faster than 4 updates a second went into that decision as well. And I'm guessing it would be very unusual anyway for people to use cycle quantize feature when cycle is less than 1 second)

@jean-emmanuel
Copy link

jean-emmanuel commented Nov 20, 2021

@sebageek is global_cycle_pos controllable with osc messages ? It feels it should be, but I can't manage to do it.
Edit: nevermind, I manage to add the missing controls but it doesn't quite fit my need (it doesn't affect the loops' playback position).

@essej essej merged commit 221db5f into essej:master Jun 17, 2023
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

Successfully merging this pull request may close these issues.

None yet

4 participants