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

Internal clock not responding to tempo changes or reset #1757

Open
dstroud opened this issue Feb 5, 2024 · 5 comments
Open

Internal clock not responding to tempo changes or reset #1757

dstroud opened this issue Feb 5, 2024 · 5 comments

Comments

@dstroud
Copy link
Contributor

dstroud commented Feb 5, 2024

tempo and reset in parameters>>clock do not seem to affect the internal clock in the code I compiled 24.02.02. Link and MIDI work but I'm unable to test Crow at the moment.

@catfact
Copy link
Collaborator

catfact commented Feb 6, 2024

i wasn't able to reproduce problems with tempo change in a quick test:

  • run awake
  • set clock source to internal in params menu
  • change tempo from params menu
  • change tempo from awake UI (uses clock_tempo param delta)
  • change tempo by setting clock_tempo from REPL

however, i did find that hitting reset from params menu is causing crazy things to happen. like multiple copies of the sequence begin to play on top each other. i initially assume this is a bug in how awakehandles clock reset, but could be systematic.

i will look at that closer given more time, but meanwhile did you have other repro steps?

@dstroud
Copy link
Contributor Author

dstroud commented Feb 6, 2024

When I perform those same steps, the param value changes but Awake's sequence continues to play at the same speed. Triggering the reset param does not reset the beat count and there's no change in Awake.

BUT... it just occurred to me that it's been several days since I restarted. Sleep+wake seems to have resolved the issue. FWIW, no issues with Awake handling reset correctly either. I'll play with it some more to see if I'm able to identify steps to reproduce.

@dndrks
Copy link
Member

dndrks commented Feb 13, 2024

however, i did find that hitting reset from params menu is causing crazy things to happen. like multiple copies of the sequence begin to play on top each other. i initially assume this is a bug in how awakehandles clock reset, but could be systematic.

@catfact , was this on awake 2.7.0? i pushed a fix for that exact behavior a few months ago, but lmk if it persists!

@catfact
Copy link
Collaborator

catfact commented Feb 13, 2024

Oh - I may indeed be running an old copy of awake, sorry

@dstroud dstroud closed this as completed Feb 22, 2024
@dstroud dstroud closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2024
@dstroud
Copy link
Contributor Author

dstroud commented Apr 2, 2024

Re-opening this as I can confirm I am experiencing this on multiple Nornses now running the official 240221 update.

Steps to reproduce:

  1. Clock param configuration:
  • source: internal
  • tempo: 300
  • link quantum 4
  • link start/stop sync: enabled
  • midi clock out: on
  • midi clock in: all
  • crow out: off
  1. Leave Norns running overnight with no script active
  2. Change clock tempo via param menu or params:set("clock_tempo", n)
  3. Compare output of the following:
    print(params:get("clock_tempo")); print(norns.state.clock.tempo); print(clock.get_tempo())
  4. When issue occurs, the value returned by clock.get_tempo() stops updating

Hoping to give a better idea of when the issue occurs, I created a test script to change the param every minute, wait a second, then compare values in the hopes. Unfortunately, it intermittently gets falsely triggered because it takes > 1 second to update the value returned via clock.get_tempo(). Not sure what that's about but here's the test script:

function init()
  local start_time = os.date("%Y-%m-%d %H:%M:%S", os.time())
  local state = "running"
  msg_1 = "start"
  msg_2 = "running test..."
  msg_3 = ""
  myvar = false
  local function check_tempo()
    params:set("clock_tempo", math.random(200, 300))
    clock.run(
      function()
        while state == "running" do
          clock.sleep(1)
          if util.round(norns.state.clock.tempo) ~= util.round(clock.get_tempo()) then
            state = "stopped"
            msg_1 = "start @ " .. start_time
            msg_2 = "error @ " .. os.date("%Y-%m-%d %H:%M:%S", os.time())
            msg_3 = "beat " .. clock.get_beats()
            print(msg_1)
            print(msg_2)
            print(msg_3)
            print("params:get('clock_tempo'): " ..params:get("clock_tempo"));
            print("norns.state.clock.tempo: " ..norns.state.clock.tempo);
            print("clock.get_tempo(): " .. clock.get_tempo())
          elseif state == "running" then
            msg_1 = "start @ " .. start_time
            msg_2 = "OK @ " .. os.date("%Y-%m-%d %H:%M:%S", os.time())
            msg_3 = ""
          end
          redraw()
        end
      end
    )
  end

  my_metro = metro.init(check_tempo, 60, -1)
  my_metro:start()
  check_tempo()
end

function redraw()
  screen.clear()
  screen.blend_mode(2)
  screen.line_width(1)
  screen.aa(0)

  local text = function(fn, x, y, string)
    screen.move(x, y)
    screen[fn](string)
  end

  screen.level(10)
  text("text_center", 60, 30, msg_1)
  text("text_center", 60, 40, msg_2)
  text("text_center", 60, 50, msg_3)

  screen.update()
end```

@dstroud dstroud reopened this Apr 2, 2024
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

3 participants