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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@scorelabs/core

v1.1.0

Published

Core logic and models for ScoreLabs music notation

Readme

@scorelabs/core

Core logic and models for ScoreLabs music notation and processing. This package provides the foundational data structures and algorithms used across the ScoreLabs ecosystem, including the Note and NoteSet models, instrument definitions, and MusicXML importing capabilities.

Installation

npm install @scorelabs/core

Features

  • Comprehensive Music Models: Strongly typed classes for Score, Part, Staff, Measure, NoteSet, Note, Pitch, and more.
  • MusicXML Import: Robust MusicXMLParser to convert MusicXML files into ScoreLabs models.
  • Type Safety: Written in TypeScript with complete type definitions.
  • Modular Architecture: Designed to be platform-agnostic (Node.js and Browser).

Usage

Importing a MusicXML File

import { MusicXMLParser } from '@scorelabs/core';

// Assuming you have the XML content as a string
const xmlContent = `<?xml version="1.0" ... >`;
const parser = new MusicXMLParser();
const score = parser.parse(xmlContent);

console.log(`Score Title: ${score.title}`);
console.log(`Number of Parts: ${score.parts.length}`);

Working with Notes and NoteSets

The core model uses NoteSet to represent a collection of notes at a specific point data (e.g., a chord or a single note).

import { Duration, Note, NoteSet, Pitch } from '@scorelabs/core';

// Create a C4 quarter note
const c4 = new Note(new Pitch('C', 4), Duration.Quarter);
const noteSet = new NoteSet([c4]);

// Transpose up a whole step
const d4Set = noteSet.transpose(2);

console.log(d4Set.pitch.toString()); // "D4"

Architecture

The library is organized into two main modules:

  • models/: Contains the data structures representing musical elements.
    • Score: The root object representing a musical piece.
    • Part: Represents a single instrument or voice within a score.
    • Staff: A collection of measures for a specific part.
    • Measure: Contains musical events like notes, rests, and directions.
    • NoteSet: A grouping of simultaneous Note objects (chords).
    • Note: The fundamental musical unit containing pitch, duration, and stylistic attributes.
  • importers/: logic for importing external formats.
    • MusicXMLParser: Converts MusicXML data into the internal object model.

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build: npm run build

License

MIT