Search code examples
audiosignal-processinglibrosametronome

Where to find resources for writing a decent metronome app?


Recently I've been trying to figure out how to write a metronome app, but I've come across many difficulties with OS time control (calling functions e.g.) or significantly inaccurate onset detection algorhithms (I've used librosa) and it seems to be a pretty complicated topic. Yet for some reason I wasn't successfull in my research upon professional metronome apps source code/tutorials/books touching the topic etc... The web seems to be filled with amateur examples and solutions that don't really meet the modern metronome app (such as Frozenapes iOS Tempo app) standards. e.g. a metronome which uses pre-recorded .wav samples when a certain tempo is called (so there are all the tempos between 30 and 300 bpm stored in the app). That kind of solutions seem to be a bit of dead end if user wants to change the tempo while metronome is working. To sum it up - I'm looking for any professional resources with code/text/whatev which isn't 2000 pages signal processing book for math graduates and could help me with designing a decent metronome with some recording features.


Solution

  • Maybe my experience with writing a metronome using Java will be helpful. The key was not relying on the system clock, but instead, on counting the exact number of PCM frames and placing the click audio PCM at that point. At a sample rate of 44100 fps, that is basically accuracy to 1/44100th of a second.

    I cannot advise you as to how to stream PCM and to count the frames as they pass. Does Python even give you access to the individual frames?