I've done this circuit :
https://www.maximintegrated.com/en/app-notes/index.mvp/id/4607
with this sketch :
void setup() {
pinMode(2, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
}
And I have some strange results... When jack is not connected/disconnected...