Skip to main content
Joboj
Participant
September 25, 2020
Question

Matching Random Seed to the bpm of a song.

  • September 25, 2020
  • 3 replies
  • 414 views

Hey Everybody,

I got a fairly straightforward question but my head hurts from trying to make it work.
So I want the random seed of a wiggle transform to go up exactly on beat with a song. I know the song is 140 bpm and I want the random seed to go up every other beat. 140/60=2.33/2=1.166666

So the random seed needs to go up by 1 every 1.1666 seconds.
I tried it with the time*1.1666 expression but this doesn't quite work because it will add 1.16666 every 1 second instead of the other way around. (I hope I am making sense)

Is there an expression I can use that will add 1 every 1.166666 seconds? Pretty much like a timer?

Thanks in advance!

This topic has been closed for replies.

3 replies

Szalam
Community Expert
Community Expert
September 25, 2020

Alternatively, you could do one or two animations and use the loopOut() expression with the offset option.

Community Expert
September 25, 2020

I'm not exactly sure what you want to do but I think you want to set random seed timeliness to true so the random seed value only changes every 1.16 seconds so that you get a random value that changes every 1.16 seconds. The value of the seed change has nothing to do with the random number that will be generated so increasing the seed value by 1 isn't the problem you are trying to solve, What you want to do is add some kind of value to a number every 1.16 seconds. 

 

Time is a decimal value so time will have to be divided by 1.16 and then rounded. To be completely accurate time should be divided by 70 divided by 2. This is what your expression should look like if you wanted the random value to be something between 0 and 10 and change 70 times a minute.

seed = Math.floor(time / (70/60))
seedRandom(seed, timeless = true)
random(10)

 

Joboj
JobojAuthor
Participant
September 25, 2020

Just as I posted this I am starting to think time*1.16666 totally works already and I was confusing myself by making things more complicated than they are.