-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate time in the song (e.g. in seconds) from a given beat and bpm of Ultrastar file #39
Comments
Best practice for BPM values in usdx files is to always use a multiple of the actual song BPM, so that it is between 200 and 400. |
the mp3 file you are using, is that maybe encoded in variable bitrate? |
The MP3 is irrelevant. |
time is relative in usdx and YASS. So, if you use a file with variable bitrate instead of coded bitrate, depending on ffmpeg version used, the pointers->timestamp conversion is off. In USDX, the current playback position of the played audio frame is what tells the code what the "current beat" in game is. |
I am just trying to understand why the values are off there. I quickly checked the relevant code in usdx and yes, your calculation should be correct. |
Found the answer: http://yass-along.com/beats/ |
You can think of BPM in Ultrastar files not as "beats per minute" but "bars per minute" in four-four time (Viervierteltakt). Anyway, the position of notes in Ultrastar files is then given in "beats per minutes". This fixes the mismatch I had in my calculation: 5 [s] / 4 = 1.25 [s] |
lol, never realized that before. Anyways, found that now in the code of USDX: https://github.com/UltraStar-Deluxe/USDX/blob/916a35c408214a35022e70b9e9629145f62803a2/src/base/USong.pas#L1742 |
Yeah, you have to know this to get it right... Anyway, displying the lyrics is now in sync with the music in my prototype. Last important thing missing now is recording notes and giving points. Yay! |
Issue type: Development discussion
I try to calculate note positions based on the BPM and beat in the song that is given in Ultrastar files.
My problem is that the values I calculate are not matching the speed when playing the file in USDX.
Example
I create a simple song file. It has 120 BPM and a single note with a duration of 10 beats:
The note of this file when viewed in Yass (or played in USDX) has a duration of 1.25 seconds.
However, with 120 beats per minute, it holds that
1 beat has a duration of 60 [s] / 120 [b] = 0.5 [s/b],
thus 10 beats have a duration of 5 [s] .
This is obviously different from the 1.25 seconds the note has in Ultrastar.
So, what is happening here? Did I make a mistake or is BPM in Ultrastar not "beats per minute"?
The text was updated successfully, but these errors were encountered: