Home Forums General Programming tempo to milliseconds?

Tagged: 

This topic contains 2 replies, has 1 voice, and was last updated by  human fly 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #73591

    human fly
    Participant

    ;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

    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

    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)

You must be logged in to reply to this topic.

Comments are closed.