Project 12 question

Can someone please explain the purpose of the 1 megoohm resistor in this circuit? The book explanation are too brief. Thank you

I am not an electronics person, but I can come up with two possible reasons:

1 - There needs to be a voltage difference across the piezo in order for it to work (and the input pin is high impedance),
2 - It is a pull-down resistor that causes the pin to read low when you're not knocking.