There are errors here (to be expected since it got from chatGPT), still here is a version you can test:
var midiremote_api = require('midiremote_api_v1')
var deviceDriver = midiremote_api.makeDeviceDriver("Aurasphere","CR Monitor 3dB Step","MW")
var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("anOutput")
var detectionUnit=deviceDriver.makeDetectionUnit()
detectionUnit.detectPortPair(midiInput,midiOutput)
.expectInputNameEquals("Bome MIDI Translator 1")
.expectOutputNameEquals("Bome MIDI Translator 1")
var surface=deviceDriver.mSurface
var mapping=deviceDriver.mMapping
var knobReal=surface.makeCustomValueVariable("knobReal")
knobReal.mMidiBinding
.setInputPort(midiInput)
.bindToControlChange(0,21)
var knobShown=surface.makeKnob(0,0,1,1)
var page=mapping.makePage("Main")
var minDb=-60
var maxDb=12
var stepDb=3
var currentDb=-20
var monitorLevel = page.mHostAccess.mControlRoom.mMainChannel.mLevelValue
page.makeValueBinding(knobShown.mSurfaceValue,monitorLevel)
monitorLevel.mOnProcessValueChange=function(activeDevice,activeMapping,value){
console.log("value="+value)
currentDb=minDb+(value*(maxDb-minDb))
}
monitorLevel.mOnDisplayValueChange=function(activeDevice,activeMapping,displayValue){
console.log("displayValue="+displayValue)
}
knobReal.mOnProcessValueChange=function(activeDevice,value,diff){
var midiVal=Math.round(127*value)
if (midiVal===65){currentDb-=stepDb}
else if (midiVal===63){currentDb+=stepDb}
else {return}
if (currentDb<minDb) currentDb=minDb
if (currentDb>maxDb) currentDb=maxDb
var normalized=(currentDb-minDb)/(maxDb-minDb)
knobShown.mSurfaceValue.setProcessValue(activeDevice,normalized)
}
At the line “.expectInputNameEquals(…” place your midi input port name.
I’m not really sure whether the normalisation used is accurate, in fact I think that a map is needed to properly create the 3db, still one step at a time. If the script works, we can go for optimising the values later. For now, note that I’ve placed two events (an mOnProcessValue of the level and the mOnDisplayValueChange). This way, we can get a log into the console so that we can see what value (0→1) represents what db. By the way I’ve changed the part of the code concerning the db change, since I guess we’re talking about 2’s complement, so 65 should yield a decrease. But this is not important right now.
Yeah it was chat as although it has errors to start with, as you become solid in the api framework, its good having something to wrestle with…BS is the most common word I use with it.
Cheers…bedtime in Sydney
Should just be dynamic/parametric though? But LUT is not the end of the world
Main issue is I can’t get qbase to recognise any script ATM
var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("anOutput")
var detectionUnit=deviceDriver.makeDetectionUnit()
detectionUnit.detectPortPair(midiInput,midiOutput)
.expectInputNameEquals("CR_To")
.expectOutputNameEquals("CR_From")
It is located here and named as per your suggestion
Yes…I opened up a working one eg example company and then all you had said made sense so I just copied that structure/naming and it loaded
Now the issue is that the CC7, channel 1, relative is not being recognised…so Im onto that atm.
Thanks so much for your help btw
Flow charts for coding are so helpful and there are a couple for a fresh startup they are a bit esoteric. I did a lot of SOP and startup charts…soooo valuable
Whats so weird, is that a pro DAW, alive for so long, spending all the resource to get Control Room, which is amazing but then leave out stepped monitoring which is 101 for pro mixing/mastering is just strange…really strange.
@m.c So you are absolutely correct about needing an LUT because its not a logarithmic taper…something proprietary it seems. So I just want to type the values inito the CR mon and have it output the 0-1 FP for each step…but you cant copy paste in the console window and js is sandboxed so you cant simply write to a file…wow why is it so hard to do basic stuff. I dont want to use 14bit so would be fine to step through LUT indexes using a relative CC
Got it all going…I use +12 headroom…just used the console output and typed the 3db steps. worked fine.
Thanks so much for your help…got me up and going
True. For such cases, where we really need the console output, I’ve created an html page for handling this. We need a virtual port to send our text to, and this page to receive it.
I understood that However, this won’t work very well when we have huge logs. For example, at the time I created this tool, I had to log nearly 20000 objects/parameters in CBs structure. Still, this is irrelevant to CB12, so no worries