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

ireal-musicxml

v2.0.4

Published

iReal Pro to MusicXML converter.

Downloads

285

Readme

ireal-musicxml

iReal Pro to MusicXML converter.

npm version GitHub Build Status

Demo

Check out the demo! You can upload one of the iReal Pro main playlists as a test.

Installation

  • Install xmllint (included in libxml2 on most platforms) - only needed for validation
  • npm install && npm run build
  • npm test

Usage

import {
  convertSync,
  convert,
  Playlist,
  Converter
} from 'ireal-musicxml'
const ireal = // Content of HTML file generated by iReal Pro or irealb:// URI
const playlistSync = convertSync(ireal)
const playlistAsync = await convert(ireal)
// => {
//   name:              // Playlist name
//   songs: [{
//     title:           // Title
//     composer:        // Composer
//     style:           // Song style for display
//     groove:          // Song style for playback
//     key:             // Key signature
//     transpose:       // Transposition in semitones
//     bpm:             // Beats per minute
//     repeats:         // Repeat count
//     music:           // Raw song encoding
//     cells: [ Cell ]  // Array of parsed cells
//     musicXml:        // MusicXML output
//   }]
// }

const playlistManual = new Playlist(ireal)
// => Same as above minus `musicXml` attribute.

const musicXml = Converter.convert(playlistManual.songs[0])
// => MusicXML output of the first song in the above playlist.
$ ireal-musicxml test/data/jazz1460.txt --songs=Blues --validate

Theory of operation

This module parses an iReal Pro URI or playlist file, and transforms each song it finds to a MusicXML lead sheet. The conversion process tries to produce a high-fidelity replica of the source sheet by recreating the following aspects of the iReal Pro format:

Harmonic information

The chords found in the iReal Pro song are translated to their MusicXML representation. Because the chords supported by iReal Pro are a subset of the harmonic expressivity of MusicXML, this translation is exact. More information can be found in this blog post.

An additional detail is the handling of "alternate chords" that can be specified in iReal Pro - these also will be handled in this converter eventually.

Rhythmic information

Because iReal Pro uses a fixed grid for each bar, timing assumptions need to be made about chord onsets, both in the iReal Pro app itself and in this converter. The timing algorithm is described in this blog post, and some follow-up works remains to be done.

Layout and styling information

iReal Pro has a distinctive visual sheet style that aims to enhance readability. This converter attempts to recreate this visual style:

  • Using rhythmic notation or slash notation to display the chords
  • Increasing the size of noteheads and chord names
  • Removing uneeded elements from the score, such as clef and staff lines
  • Respecting the original positioning of measures to best reflect the structure of the song
  • Fitting the score on one page where at all possible

MusicXML support for layout and style is expressive enough to represent all these customizations. Unfortunately, existing engraving software do not support the full set of MusicXML directives, thus recreating the intended style only partially. The (heavy-handed) solution is to go one additional step and convert the MusicXML output from this present converter to the native format of the desired engraving software.

Backing track information

The backing track patterns of the iReal Pro styles are not documented. Therefore, a mapping is done to support playing back the converted MusicXML scores that replicates or approximates the original iReal Pro playback. This is achieved in 2 phases:

  • First, the MusicXML sound/play/other-play[@type = 'groove'] element is used to capture the playback style as specified in the iReal Pro song. Because MusicXML does not currently feature a dedicated element to specify the performance style, the generic other-play element was selected to capture this information.

  • Next, the downstream playback component interprets the above MusicXML element to generate a backing track for the score. This is done in musicxml-midi which utilizes an extensive library of "grooves" to map the incoming iReal Pro style to MIDI accompaniment tracks.