Change the master project tempo with a midi CC

Nice one, never seen it before! :slight_smile:

You’ll have to use a custom script for that, it can’t be directly done using the mapping assistant, apart of course from the tapTempo command which is not what you’re after obviously.

So, here’s a snippet to get you going:

var midiremote_api = require('midiremote_api_v1')

var deviceDriver=midiremote_api.makeDeviceDriver("Test","BPM Change","m.c")

var midiInput=deviceDriver.mPorts.makeMidiInput("midiInput")
var midiOutput=deviceDriver.mPorts.makeMidiOutput("midiOutput")

var detectionUnit=deviceDriver.makeDetectionUnit()
detectionUnit.detectPortPair(midiInput,midiOutput)
    .expectInputNameEquals("midi input")
    .expectOutputNameEquals("midi output")

var surface=deviceDriver.mSurface

var knobBPM=surface.makeKnob(0,0,1,1)
knobBPM.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput)
    .bindToControlChange(0,24)
 
var customBPMVar=surface.makeCustomValueVariable("customBPMVar")

var bpmChangeStep=1

var page=deviceDriver.mMapping.makePage("Custom")

var currentBPM=0

page.mHostAccess.mTransport.mTimeDisplay.mOnChangeTempoBPM=function(activeDevice,activeMapping,bpm){

    currentBPM=bpm 

}

knobBPM.mSurfaceValue.mOnProcessValueChange=function(activeDevice,value,diff){

    //console.log("value="+value+" diff="+diff)
    
    if(value==0 || diff<0){
    
        //turn left 
        
        if (currentBPM-bpmChangeStep>0){
            currentBPM-=bpmChangeStep
            customBPMVar.setProcessValue(activeDevice,currentBPM)
        }
        
    } else {

        //turn right
      
        if(currentBPM+bpmChangeStep<=360){
    
            currentBPM+=bpmChangeStep
            customBPMVar.setProcessValue(activeDevice,currentBPM)
    
        }
    
    }

}

var customBPMHostValue=page.mCustom.makeHostValueVariable("customBPMHostValue")

page.makeValueBinding(customBPMVar,customBPMHostValue).mOnValueChange=function(activeDevice,activeMapping,bpm,diff){
    
    page.mHostAccess.mTransport.mTimeDisplay.setTempoBPM(activeMapping,bpm)

}


If you are not into scripting, but you have the name of the midi input port of the device available, plus the knob’s midi CC/channel/type (relative, twos etc) I can upload a midi remote here.

2 Likes