You can change the value of
MAX_SAMPLES anytime you want. If you want to set it in your callback then you can do the following:
Code:
def onKeyDown(key):
global samples, MAX_SAMPLES
if key == ' ':
#Clear samples and start timer
samples = 0
MAX_SAMPLES = 45 * 30
viz.starttimer(1,SAMPLE_RATE)
viz.callback(viz.KEYDOWN_EVENT,onKeyDown)