tempo to milliseconds?

Home Forums General Programming tempo to milliseconds?

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #73591
    human fly
    Participant
      • Topics: 124
      • Replies: 1070
      • Total: 1194
      • ★★★★

      ;o)

      tempo to milliseconds… how am i going to make that knob…

      tempo = bpm/beats per minute.
      60,000 milliseconds per minute…

      cannot have inverted values ie: high to low, on Ctrlr
      controls – so i can’t bodge it and just have decreasing mS
      anyway … so.. given a tempo range of, say, 30 to 240 bpm …
      taking 120bpm as a reasonable place to start…
      this will do:

      How to convert ms (milliseconds) to BPM (beats per minute) and vice versa

      so i have to divide 60,000 by the BPM to get the milliseconds.
      simple. (a little bit more complicated to get that to pitch an
      oscillator to produce a bpm-synced LFO, but that’s for some
      other time)

      now, to write the method… !

      #73593
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        erm.. so 60000/120(bpm)=500 … and i want 4 steps
        per beat, so 500/4 =125ms per callback. …?
        running at 100ms right now, looks pretty alright 🙂

        #73594
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          cool, it works – but i cannot get any ‘realtime’ variation
          of tempo: once it starts, thats the tempo until i stop it,
          change the tempo knob, and run it again:

          local base = 60000
          local bpm  = panel:getModulatorByName("tempo"):getValue()	
          -- [tempo range is 30-240] --
          millisec = base/bpm/4
          
          --start timer
          timer:setCallback (1, runCallback)
          timer:startTimer(1, millisec)

          would i have to start timer, then stop timer, then restart,
          for each step?(!!) – or could a function be inserted in
          startTimer() that monitors ‘tempo’ value ? (s’pose not…)

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The forum ‘Programming’ is closed to new topics and replies.
        There is currently 0 users and 22 guests online
        No users are currently active
        Forum Statistics
        Threads: 2,495, Posts: 17,374, Members: 77,605
        Most users ever online was 12 on January 22, 2019 3:47 pm
        Ctrlr