forum

Parsing .osu files

posted
Total Posts
9
Topic Starter
qwertystop
Hello!
(First off, I wasn't sure if this should go in here or in Help - it's not exactly a bug or game issue, but it's not development of something directly related to playing osu! either. Sorry if I got it wrong.)

As a learning-to-make-games project, I'm making a fairly simple music game. In the interest of having a large volume of songs to test it on, and since I don't know enough about audio processing to find beats in a music file automatically, I'm trying to read timing data out of my existing osu! library. I've already found https://osu.ppy.sh/wiki/Osu_%28file_format%29 for the filetype documentation, and both circles and spinners are simple enough, but I'm not sure how to get full timing data for sliders - the first one is given, but I don't see the rest there. Also, what's the "addition" field at the end of each hitObject?

Any help would be much appreciated.
abraker

qwertystop wrote:

but I'm not sure how to get full timing data for sliders - the first one is given, but I don't see the rest there.
from https://osu.ppy.sh/wiki/Slider

"A slider's speed defines how much time it takes to travel a given distance--or equivalently, how far the slider travels in a given time.

Slider speed is measured in hundreds of osupixels per beat, so a slider with a speed of 1.00 will travel 100 osupixels (or, 100 pixels at 640x480 resolution) in one full beat. This means that sliders with a particular speed setting will travel faster when the BPM is higher.

Slider speed can be assigned from the Timing tab from the editor main window. You can also assign a multiplier to this speed value by adding an inheriting timing section.

It has recently become popular to use slider speeds which are multiples of 0.16. (for instance, 1.60, 1.76, 1.92, etc.) This has the effect of lining up the endpoint of a straight horizontal/vertical slider with osu!'s grid when the slider begins and ends on a whole or half beat, but has its drawbacks when it comes to slightly curved sliders. "

qwertystop wrote:

Also, what's the "addition" field at the end of each hitObject?
Not sure myself
Topic Starter
qwertystop
Ugh... So:
The actual slider just has a path, defined in terms of a series of coordinates, and a number of repetitions. Speed is defined over two different areas (ms/beat, in timing points, and 100px/beat, in difficulty settings), both of which I was previously fine to just skip.
So if I want to figure out a timestamp for each time either end is reached during the slider, I need to calculate the speed, calculate the distance (complex, and I've no idea how to do it), and combine the two (simple again). And then repeat that interval for each repetition.

Any idea how to calculate the distance the slider travels for a given set of coordinates? Or a simpler way to get the timestamps?
abraker
osu!px/s = (bpm / 60) × sv × 100

You might want to look here as a reference to how it would be done. Slider stuff should be here and timing calculation should be here
Topic Starter
qwertystop

abraker wrote:

osu!px/s = (bpm / 60) × sv × 100

You might want to look here as a reference to how it would be done. Slider stuff should be here and timing calculation should be here
That does look likely, thanks.
Topic Starter
qwertystop
Hm...
Am I going to have to worry about the possibility of the timing section changing mid-slider? Is that a thing, and more to the point does it affect the slider speed? Assume I'm only going to use Ranked/Approved beatmaps. It seems at first like it would make a beatmap unplayable if it did anything - but on the other hand I'm not very good at the game anyway, so that might just be me.
abraker

qwertystop wrote:

Hm...
Am I going to have to worry about the possibility of the timing section changing mid-slider? Is that a thing, and more to the point does it affect the slider speed? Assume I'm only going to use Ranked/Approved beatmaps. It seems at first like it would make a beatmap unplayable if it did anything - but on the other hand I'm not very good at the game anyway, so that might just be me.
I wouldn't surprised if older maps from before 2010 have these. Inherited timing sections dont change sv mid slider. I think uninherited timing sections will cause the proceeding slider points to be snapped - time wise - to the BPM scale. I have to see myself if slider velocity will change due to BPM in that case, but doubt it. Dont take my word for it though, until I can confirm it. You are welcome to test and see if what I said is true meanwhile.
Topic Starter
qwertystop
Thanks very much. Just finished writing all the code to extract times... probably could use some polish, but it runs in less time than I can notice and happens in preprocessing anyway, so that's low-priority. Now to get the music playing in sync.

Is this likely to be a useful script outside of my specific situation, that there's any reason to post it here? Alternately, do you want to see it for some other reason?
abraker
While not required, peppy recommends projects to be open source.
Please sign in to reply.

New reply