I tried this years ago to try to develop my ability to play by ear.

What I ended up learning is that if you want to learn to play by ear, learn to sing, don't bother with exercises like this, at least not until you've gotten some singing practice in.

When singing, you have to hear the intervals in your head before you sing them, so developing that ability to generate the intervals in your head will help you to recognize them later on.

This.

With some practice you can even get a decent idea what note a given sound is by humming it - it's far from precise, but at least you can tell e.g. E from G.