MusicIR is a music information retrieval package for ruby. You can represent a single stream of notes (multiple streams coming eventually) and then perform meter detection and phrase detection, calculate beat similarity matrices, etc.