It's probably harder than it sounds! You'd probably have to use Fourier transformations (And that probably means using integrals), the mic sound quality would probably have to be set pretty high, which means shorter mic sampling, and who knows what else.