I prepared a script you may want to check. While playing it checks for channels with meter change, and when the playback is stopped it allows us to select these particular tracks, so we can then obviously delete it.
I have two midi CC messages, one is for toggling whether the script should do these checks while play is active, and the other one is for executing the final actions after we have hit stop and checking is active. You can go further and instead of using this second cc you can immediately execute the action. You’re going to need a PLE, not just the script.
Script:
// @ts-nocheck
var midiremote_api = require('midiremote_api_v1')
var deviceDriver = midiremote_api.makeDeviceDriver("Test", "Find Tracks With Meter Activity", "mc")
var midiInput = deviceDriver.mPorts.makeMidiInput("anInput")
var detectionUnit=deviceDriver.makeDetectionUnit()
detectionUnit.detectSingleInput(midiInput)
.expectInputNameEquals("Bome MIDI Translator 1")
var surface = deviceDriver.mSurface
var buttonFindOnOff=surface.makeCustomValueVariable("buttonFindOn")
buttonFindOnOff.mMidiBinding
.setInputPort(midiInput)
.bindToControlChange(0,0)
var lampFindOnOff=surface.makeLamp(0,0,1,1)
var labelFindOnOff=surface.makeLabelField(1,0,4,1)
var customLogTracks=surface.makeCustomValueVariable("customLogTracks")
customLogTracks.mMidiBinding
.setInputPort(midiInput)
.bindToControlChange(0,1)
var lampLogTracks=surface.makeLamp(0,1,1,1)
var labelLogTracks=surface.makeLabelField(1,1,4,1)
var customPlay=surface.makeCustomValueVariable("customPlay")
var customExecutePLE=surface.makeCustomValueVariable("customExecutePLE")
var mapping = deviceDriver.mMapping
var page=mapping.makePage("Default")
page.setLabelFieldText(labelFindOnOff,"Scanning")
page.setLabelFieldText(labelLogTracks,"Log Tracks")
var daMixer=page.mHostAccess.makeDirectAccess(page.mHostAccess.mMixConsole)
var tagMeterAll=4009
var tagChannelName=1024
var changedTracksSuffix="[altered]"
var pleCommandName="Select Tracks with [altered] suffix"
var mapChannels={}
var lstChannelsChanged=[]
var playing=0
var finding=0
buttonFindOnOff.mOnProcessValueChange=function(activeDevice,value,diff){
if(value==1){
finding=1-finding
lampFindOnOff.mSurfaceValue.setProcessValue(activeDevice,finding)
}
}
var customLogTracksHostValue=page.mCustom.makeHostValueVariable("customLogTracksHostValue")
page.makeValueBinding(customLogTracks,customLogTracksHostValue).mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
customLogTracks.setProcessValue(activeDevice,0)
logAllChangedTracks(activeDevice,activeMapping)
}
}
page.makeCommandBinding(customExecutePLE,"Process Project Logical Editor",pleCommandName)
page.makeValueBinding(customPlay,page.mHostAccess.mTransport.mValue.mStart)
page.mHostAccess.mTransport.mValue.mStart.mOnProcessValueChange=function(activeDevice,activeMapping,value){
playing=value
console.log("playing="+playing)
if(finding==1 && playing==1){
fetchAllTracks(activeMapping,true)
}
}
function fetchAllTracks(activeMapping,initializing){
if(initializing){
mapChannels={}
lstChannelsChanged=[]
}
var mixerID=daMixer.getBaseObjectID(activeMapping)
var channelsCount=daMixer.getNumberOfChildObjects(activeMapping,mixerID)
if(channelsCount>0){
for(var i=0;i<channelsCount;i++){
var channelID=daMixer.getChildObjectID(activeMapping,mixerID,i)
if(lstChannelsChanged.indexOf(channelID)!=-1) continue
var channelType=daMixer.getObjectTypeName(activeMapping,channelID)
if(channelType=="OutputChannel") continue
var meterValue=daMixer.getParameterProcessValue(activeMapping,channelID,tagMeterAll)
if(initializing==false){
var previousValue=mapChannels[channelID]
if(previousValue!=meterValue){
lstChannelsChanged.push(channelID)
}
}
mapChannels[channelID]=meterValue
}
}
}
var pollCountMax=5
var pollCount=0
page.mOnIdle=function(activeDevice,activeMapping){
if(finding==1 && playing==1){
pollCount++
if(pollCount==pollCountMax){
pollCount=0
fetchAllTracks(activeMapping,false)
}
}
}
function logAllChangedTracks(activeDevice,activeMapping){
if(lstChannelsChanged.length>0){
lstChannelsChanged.forEach(function(channelID){
var currentName=daMixer.getParameterDisplayValue(activeMapping,channelID,tagChannelName)
currentName=currentName+changedTracksSuffix
daMixer.setParameterDisplayValue(activeMapping,channelID,tagChannelName,currentName)
})
customExecutePLE.setProcessValue(activeDevice,1)
}
}
The necessary PLE named “Select Tracks with [altered] suffix”:
I have set the action to “Select” you can obviously change it to “Delete” after some testing.
Here’s a small video demonstrating the script:
Could you please share the use case you’re thinking of? I always like to learn new workflows.