![]() If you use some sort of elapsed-time function, it’s still not going to be accurate enough, and if the song skips for whatever reason everything will get thrown off. in the Update function), an inconsistent FPS is gonna throw the whole thing off. It won’t work consistently! If you use a timer that increments every frame (e.g. Every object that needs to be in sync should do so using only the song position, and NOT anything else. Anyway, now that we have set up our Conductor, time to take care of the objects that need to sync to it! - 2. This was used in my game to slow all the songs down 20% because I only realised after composing the music that it was too difficult. ![]() By incorporating it into my song position variable, I can change the playback speed and still keep everything in sync. Songposition = (float)(AudioSettings.dspTime – dsptimesong) * song.pitch – offset Aside: the song.pitch is an inbuilt variable in Unity that gives the speed the song is playing at. What I do is, in the same frame that I play the song, I record the dspTime at that moment, so then my song position variable is set on every frame as follows: This varies from engine to engine, but in Unity for example, the variable to use is AudioSettings.dspTime.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |