beatsin8() and beatsin16() are very cool functions.
I’m wondering if anyone has managed to change parameters on the fly without completely resetting the beat? I’d really like for the beat to continue at the current location, but with modified parameters, such as reversing the phase or changing the speed.
That’s interesting, I’ll give that a shot. Right now, I get a pretty cool effect with led’s jumping all over the place, i.e. with an EVERY_N_MILLISECONDS(200) change of the phase. Am also combining a couple of beats to get a more complex pattern. Will see what blending does.
What I’m looking for is to combine sound reactive triggers, volume, peaks, peaks per second, etc, calculations to make some cool sound reactive routines.
I think you can do quite a lot without having to resort to an MSGEQ7 or FFT’s.
Yeah I’m just looking at this now for a sound reactive thing I’m doing. Beat detection looking good but for sinelon style effects I was hoping to change bpm on the fly. I need more thinking time but will keep an eye out here.
After a day of fiddling, I ended up with some cool effects by changing the timebase and phase_offset on the fly, but was unable to get them to work well with sound and never did get a smooth transition. In addition, ambient noise increased significantly when I merged my sound and modified beatsin8 sketches (using APA102). Needs some debugging.
Am going to play with some sketches I made a while back that are inspired by:
A bit more thinking: 3/4 x 65535 is 49151.25. I think I see.
So should be a matter of storing current Beatsin16 position, picking your bpm, and then doing millis() timebase and 0-65535 scaled phase shift on the position previously saved.
Position alone is not enough information to calculate the correct phase shift to apply if you need direction to be taken into account.For example an unscaled position of 16383 could be on the way down or on the way up.
I’ll be happy with just being able to specify the starting position
I was only able to get this to work when zero-crossing. That is, you need to know when the sine functions are equal-valued, and cross-over to a new BPM/phase then.