playMaker

Author Topic: BPM from song to float doesn't fit in the game![SOLVED]  (Read 1851 times)

Caro

  • Playmaker Newbie
  • *
  • Posts: 22
BPM from song to float doesn't fit in the game![SOLVED]
« on: July 23, 2018, 05:32:56 PM »
Hi all!

This post got really long, a short summary: got 145BPM to miliseconds (.4137) - using that as a float to pulsate objects - but the pulse is too slow compared to the music (around 120 bpm I counted)

I'm working on a music visualization tool and I've used the BPM converted to MS(miliseconds) to a float that I use for making the different objects move to the rythm of the music.

However the animations just don't fit the rythm! The BPM is 145 which is a float of 0.4137 and I've tried "iTween Scale To" to scale a sphere to let's say instantly to 2, 2, 2 and then use this float to go back to 1, 1, 1 over time. However it's totally wrong. There is of course an offset that I also need to work on fixing - that the Sphere will scale up a little before or after the beat - but this is not the problem - it's pulsating SLOWER than the actual bass of the music.

I then thought it could be the iTween script, but using Set Scale has the same issue.

The game was made at a jam and I was running out of time so I had to brute force it and manually adjust the float until it fit the pulse. This manual input is 0.336 which had nothing to do with the previous number.

I also found out that the pulsating of the sphere was different in the build than in the editor. - so 0.336 only works in the editor and is thus not the right number either.

Does anyone know anything about the speed of executing the states? using iTween or whatever I'm using that could make a teeny tiny delay? This is like 0.005 ms can make a mismatch.

I actually had several programmers helping me at the jam and they didn't know playmaker but tried to fix the problem without success :(

I tried counting the pulsating sphere "scale-jumps" in one minute and came to 150BPM which is 400ms and not 336ms o.O

I really wanna continue working on this tool, any help would be awesome! :) I'll be happy to send the project, but it's a bit jam-messy :)
« Last Edit: July 27, 2018, 09:02:47 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: BPM from song to float doesn't fit in the game!
« Reply #1 on: July 24, 2018, 04:13:06 AM »
Hi,

the question would be actually wether the delay accumulates or is it in synch but offsetted?

 but for this, I think you need to use a dedicated system like:

https://assetstore.unity.com/packages/tools/audio/koreographer-professional-edition-44270

 and it has playmaker integration.

You could maybe contact the author and check with him if such high bpm is supported to begin with.


 Bye,

 Jean


Caro

  • Playmaker Newbie
  • *
  • Posts: 22
Re: BPM from song to float doesn't fit in the game!
« Reply #2 on: July 25, 2018, 04:58:20 AM »
Okay thanks - I'll look into that - but can it really be true that I need to buy a tool for 100 euros just to be able to get a precise iTween Scale To?

I tested with Set Material Color + Set Scale and those two are in sync with eachother and ALMOST in sync with the float time change - but the iTween is just very much off.. - so it must be the iTween that is the problem. I'll try a test where I make the animation myself. The thing is that I want the lerping effect so I can't use Set Scale

So another guy who did a lot of visuals for music said it's good to be able to reset the pulse because it can get offset after some time because just the smallest time will eventually make the difference - and I guess "145 bpm" just isn't precise enough.

You asked wether the delay accumulates or is it in synch but offsetted - I'm not sure I understand exactly what you mean, but I see that the iTween animation is too slow right from the start... if it gets even slower over time I don't know.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: BPM from song to float doesn't fit in the game!
« Reply #3 on: July 25, 2018, 05:15:22 AM »
Hi,

 iTween is an old system and I would suggest you try dotween instead.

also, you need to make sure about what exactly goes wrong to know what to address, for example, if you use a custom timer, does it gets delayed too? no tweening, no nothing like turning off and on an object, then you can move on once you start with a good base.

 Bye,

 Jean

Caro

  • Playmaker Newbie
  • *
  • Posts: 22
Re: BPM from song to float doesn't fit in the game!
« Reply #4 on: July 26, 2018, 06:02:58 AM »
alright I'll try dotween thanks.

It worked the worst with iTween and considerably more precise without iTween and using Set Scale for example instead.

I got help from a programmer who changed it so it fires a fresh state machine each time space it tapped and then used timestamps to adjust for the mismatch that eventually came and somehow got it to record the time between the taps and into a float. I'm still studying his state machines and trying to understand exactly what he did, but it's working like a charm now :)

if anyone needs a copy of this in the future i'd be happy to send a package.