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

@jstarpl/mml-iterator

v1.2.1

Published

MML(Music Macro Language) Iterator

Downloads

26

Readme

mml-iterator

Build Status NPM Version License

MML(Music Macro Language) Iterator

This is a fork of the (mml-iterator)[https://github.com/mohayonao/mml-iterator] by mohayonao, with some syntax extensions for greater compatibility with songs that can be found on the internet. Should be syntax backwards-compatible with the original, but it has been refactored into an ES module.

Installation

$ npm install @jstarpl/mml-iterator

API

MMLIterator

  • constructor(source: string)

Instance methods

  • next(): { done: boolean, value: object }
  • [Symbol.iterator]: self

Example

import MMLIterator from "@jstarpl/mml-iterator";

let iter = new MMLIterator("t200 o6 l8 e g > e c d g");

for (let noteEvent of iter) {
  console.log(noteEvent);
}
{ type: "note", time: 0.00, duration: 0.15, noteNumber:  88, velocity: 100, quantize: 75 }
{ type: "note", time: 0.15, duration: 0.15, noteNumber:  91, velocity: 100, quantize: 75 }
{ type: "note", time: 0.30, duration: 0.15, noteNumber: 100, velocity: 100, quantize: 75 }
{ type: "note", time: 0.45, duration: 0.15, noteNumber:  96, velocity: 100, quantize: 75 }
{ type: "note", time: 0.60, duration: 0.15, noteNumber:  98, velocity: 100, quantize: 75 }
{ type: "note", time: 0.75, duration: 0.15, noteNumber: 103, velocity: 100, quantize: 75 }
{ type: "end", time: 0.9 }

MML Syntax

NoteEvent

  • [cdefgab][-+]?(\d+)?\.*
    • note on (default: l)
    • e.g. c e-8. g16
  • [ ([cdefgab][-+]?|[<>])+ ](\d+)?\.*
    • chord (default: l)
    • e.g. [ >g<ce ]2 [ >gb<d ]2 [ >g<ce ]1
  • rp?\.*
    • rest (default: l)
    • e.g. l16 crcc crcc crccr crcc

NoteLength

  • l(\d+)?\.*
    • length (default: 4)
    • e.g. l8 cc l4 e l2 g
  • ^(\d+)?\.*
    • tie (default: l)
    • e.g l16 c^^ e^^ g^
  • q(\d+)?
    • quantize (default: 75)
    • e.g. l16 q50 crcc crcc crcc crcc

NotePitch

  • o(\d+)?
    • octave (default: 4)
    • e.g. o4 ceg o5 c
  • >(\d+)?
    • octave up (default: 1)
    • e.g. ceg < c
  • <(\d+)?
    • octave down (default: 1)
    • e.g. c > gec

Control

  • t(\d+)?
    • tempo (default: 120)
    • e.g. t140 cdefgab<c
  • v(\d+)?
    • velocity (default: 100)
    • e.g. v75 c v50 e v25 g
  • $
    • infinite loop
    • e.g. l2 $ [fa<ce] [gb<d] [egb<d] [ea<c]
  • /: ... | ... :/(\d+)?
    • loop (default: 2)
    • commands after | are skipped in the last loop
    • e.g. l2 /: [fa<ce] [gb<d] [egb<d] | [ea<c] :/4 [eg<c]

License

MIT