npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

osu-mania-parser

v1.0.0

Published

A module that converts osu!mania beatmaps into a Javascript Object.

Downloads

5

Readme

osu-mania-parser

A module that converts osu!mania beatmaps into a Javascript Object. This allows users to easily convert their osu!mania beatmaps for use in other VSRGs.

This parser is made specifically for osu!mania. As such, support for the other game modes is highly unlikely.

Installation

npm install osu-mania-parser

Usage

var parser = require('osu-mania-parser')

var beatmap = parser.parseFileSync('filepath/ofmap.osu');
console.log(beatmap);

Returned Object

beatmap = {
    title: "Romanized Song Title",
    artist: "Romanized Artist Name",
    creator: "Beatmap Creator",
    version: "Difficulty Name",
    source: "Song Source",
    tags: [ "tags", "placed", "as", "an", "array" ],
    mapId: "Beatmap ID",
    mapsetId: "Beatmap Set ID",
    previewTime: 500, // Preview time in milliseconds
    keyCount: 4, // Number of keys (Circle Size)
    hpDrain: 8, // HP Drain Rate
    difficulty: 8.5, // Overall Difficulty
    keyPositions: [ // x value per key position, arranged in ascending order
        64,
        192,
        320,
        448
    ],
    minBpm: 120, // Lowest tempo of chart
    maxBpm: 240, // Highest tempo of chart
    nbNotes: 500, // Number of Notes
    nbHolds: 125, // Number of Holds
    timingPoints: [ // List of timing points
        {
            time: 23, // offset in milliseconds
            bpm: 180, // tempo of timing section, rounded to nearest whole
            velocity: 1, // slider velocity as a multiplier
            timingSignature: 4, // time signature of timing section
            sampleSet: 0, // default sample set for hit objects
            sampleIndex: 0, // custom sample index for hit objects
            volume: 100, // volume percentage for hit objects
            uninherited: true, // whether or not this timing point is uninherited
            kiaiTime: false, // whether or not this timing section is in kiai time
            omitFirstBarLine: false // Whether or not the first bar line is omitted
        }
    ],
    hitObjects: [
        {
            type: "note", // type of hit object, either "note" or "hold"
            hitSound: [ "normal", "whistle", "finish", "clap" ], // which sounds will play when the object is hit
            newCombo: false, // whether the hit object forces a new combo
            comboColorsSkipped: 0, // number of colors skipped when a new combo starts
            x: 64, // x position of the hit object, used for key position
            y: 192, // y position of the hit object, unused
            time: 356, // offset of hit object in milliseconds after audio start
            endTime: 689, // offset of hold note release in milliseconds after audio start; equal to time for notes
        }
    ]
}

Methods

parseFileSync(filepath)

Parses the given file. Returns a Beatmap.

// Parses an osu!mania beatmap and writes it to a json file named beatmap.json
const fs = require('fs');

var beatmap = parseFileSync('./path/to/beatmap.osu')
fs.writeFileSync(`./beatmap.json`, JSON.stringify(beatmap, null, 4))

To-do

  • Add support for custom hit samples
  • Parse beatmaps from a file stream
  • Add asynchronous version of methods (low priority)