Hello, I'm a novice with electrical signals and audio processing, but I have a really interesting idea that I'd like some insight into.

The broad use case is such:
I'd like to connect the 1/8" jack from my headphones to my teensy/audioboard and do some processing on the audio received to see if I can identify what song is being played.
This boils down into 2 specific cases:

1. Learning: I'd like to look at the input, and learn as much about the song being played (Say, BPM or # of peaks seen over a period of time, or duration of the signal). I would store this information on, say an SD card.
2. Identification: Then for any arbitrary audio input, I'd like to try and identify which song is being piped into the teensy.

Additional information:
The number of songs I need to recognize is small < 10

My questions are:
1. Can I safely connect the headphone jack to the line in of the teensy audio board
2. Is there a better way to do this / is this crazy (namely, am I using the wrong parts or is the idea ill-conceived)

Thanks again, I can't wait to see if this is something I can accomplish