I see there's an answer about frame counting already, but I can share my investigations on this topic. I published an article recently about frame counting, generating waveforms and streaming metronome sounds. Would be happy if you find this helpful to build your app