the BPM for you project is normally set via the bottom timeline ui:
If you want to do this procedurally, you’d have to script it by setting the bpm on the Time Component used by your project. This can be done by using the tempo member of the local time:
me.time.tempo = 128
In you case, when using a switch, you could make use of a Execute CHOP that runs this script onValueChange:
def onValueChange(channel, sampleIndex, val, prev):
me.time.tempo = val
return
val being the current value of the referenced CHOP channel.