What does the 1M resistor do in this circuit? (knock sensor)

One day, I'll investigate this. I suspect the 1M value was found "empirically",
namely what worked to produce a readable voltage between 0 & 5v for a
common piezo and nominal knocks - eg, somewhat less than a hammer
blow. If the R is too small, it'll load down the piezo, and lessen the max
voltage, and the voltage will also decay away rather quickly. If you don't
have 1M, how about 100K.