Conversation
ac622ef to
9e6d6dc
Compare
|
This looks interesting, as I am also using this library for lighting effects. I'll give it a try in my application. But this other PR is oddly similar: #392. I guess multiple people wanted this and developed it independently? |
|
@phatpaul I find it hard to tell if the other PR is completely independent (it doesn't expose a command line parameter, for example). I can't test the other one the way I use it though (I rely on the command line), but it's also just one giant commit so maybe there are slight differences in what they do/how they work. I do notice that the other one missed the hardcoded The only things I can say for sure are:
|
|
I've been comparing the 2 PR a few weeks ago and finally got the time to try and add one of them in my project. |
|
Tested my things over the weekend, behaviour was still as expected.
This sounds correct. I run 10 or so aubio-track processes in parallel and switch which one I'm using as a beat source. Setting/changing them on the fly was never a requirement for me. It's probably not too difficult to add to this PR though? If you (or anyone) creates a patch for it I can add it to this PR, or a maintainer can add it regardless. |
|
Good to see other people interested in that as well. I have the same use case, lighting control, and needed to work around a problem where aubio would jump between ~178 bpm and ~120 bpm on some of the tracks I tested with. (As far as I can tell, when it stops detecting beats during more quiet passages, it would default back to 120bpm.) I wanted real-time updating of estimated bpm, so I implemented it that way. The PR is more of an afterthought, which is why the description isn't great and why I seem to have completely missed this existing one. My PR only refactors the bpm-dependent code into @barbeque-squared regarding the missed beats: That one is interesting because my application also misses a single beat occasionally. It fairly consistently misses a beat every "few" (maybe around 100? 200?) beats. I originally suspected my code, especially since it consistently reports 1-2 bpm faster than the DJ controller. But maybe this is the algorithm in aubio not working well for bpm values other than 120? TBH by now I'm treating my PR as essentially abandoned. I'm not sure I will find the time to develop it further. |
Ah yeah I didn't get that from your PR. I don't really use the actual/estimated BPM anywhere, but I know most 'real' lighting controls do use it. Nice use of aubio though!
Probably. Your +1/+2 observation is also interesting, would definitely explain why it appears to miss a beat every "few" beats (with "few" being the bpm). I don't know where the +1/+2 is coming from, but if it's doing that regardless of bpm, that would explain why the skipping is (to me) so much more noticeable on 60bpm than it is on 200bpm. Looking back on my PR, I wonder if my window size adjustment is wrong. Once I have some time I'll probably change it and also add library functions to this PR. |
|
@tqzamf I have that +X bpm issue too. The actual error in the reading varies but will always be the same for the same real bpm / target bpm combo. |
9e6d6dc to
6794ebf
Compare
Aubio has 120 bpm hardcoded in various places. I use it to detect beats in live music to have my lighting synced to the music, which can have a different bpm. Some real-world problems this is trying to address:
This PR adds an extra
-b/--bpmcommand line parameter to set the target bpm. I've been using this for quite some time now, at anything higher than 120 it's fine. I didn't go as low as 15, but 60 works well enough. At ~60 it does appear to sometimes miss a beat (maybe I missed a buffer length somewhere?) but it's still a lot better compared to the bpm being hardcoded at 120.I only fixed tests enough so that it compiles again.