PDillis / stylegan3-fun

Modifications of the official PyTorch implementation of StyleGAN3. Let's easily generate images and videos with StyleGAN2/2-ADA/3!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

visualizer music synchronisation idea

nicolai256 opened this issue · comments

hello,
so i've been thinking on how to implement the animating of the stylegan to music in the visualizer.
this should be fairly easy to be honest.
i found this BPM detector on github. (it's pretty fast, calculates the bpm in +-2 seconds)
https://github.com/scaperot/the-BPM-detector-python/tree/4156ea7ba0f0883ff8ff3fa52fd386aa93ff9478
the code for running this python file is
python bpm_detection.py --filename song_name.wav

the native animation speed of the visualizer is 0.25 (4 seconds per fully new image), if we calculate this into beats per minute this is
60 (seconds) * 0.25 (anim speed) = 15 BPM
so basically an "anim speed of 1" is "1 second" so "60 BPM"

so if we want to calculate the anim speed for a generated bpm we do this (for example BPM=101.626)
101.626(generated BPM) divided by 60(seconds) = 1.6938(anim speed)

so basically the calculation is
"generated BPM" divided by "60 seconds" = "anim speed"
(the 60 seconds always remains constant because it's beats per Minute but could be divided or multiplied by a factor of 2 to keep the sync but make the animation faster or slower (so multiply the anim speed connected to bpm by 0.125, 0.25, 0.5, 1, 2, 4, 8)

so basically we could connect the generated anim speed as a button to connect to the anim speed with then a couple more buttons to multiply or divide the anim speed by 2 to make it faster or slower but still matching the beat.

let me know what you think, i saw that u were planning to do something like this in your TODO list so i thought i'd drop it here :)

Sounds interesting, but it's not what I had in mind. If you manage to do it, I'll be happy to give it a look!