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

musikov

v0.4.4

Published

MIDI files run thru Markov chains!

Downloads

11

Readme

#Musikov: A Musical Markov Experiment

##Contents:

##About: Run a Markov chain generator on MIDI files! Using simple Markov analysis, generate samples in the style of your favorite artist.

##Installation and Usage: ###General Usage

Usage is pretty simple. Just:

  1. Install with $npm install Musikov --save

  2. Include it in your js with var Musikov = require('Musikov');

  3. Finally, call it with Musikov.doSongs('mozart');.

Note that Musikov does not return anything, other than success or error messages as appropriate.

###Parameters The main function of Musikov, doSongs(), takes one required and one optional parameter as follows:

  • artist: Required. The name of the artist you wanna analyze. There must be a folder with this artist as its name in the current directory (or, if using the parameter below, in the directory specified below).

  • options: Optional. This optional options object (try saying that three times fast!) itself includes a bunch of options (all of which, themselves, are optional):

  • dir: Parent directory of the midi files. Useful if you wanna run Musikov on some far-away MIDI files. Defaults to ./sampleMids/, which is a folder of some assorted classical works.

  • res: Resolution of the sampling. Basically, a higher resolution (default) means that the actual, exact input values of parsed notes will be used. A lower value means that Musikov will round values somewhat. Minimum of 1, maximum of 10, and default of 10.

  • len: Length of the resultant song, in number of notes (not duration!). Defaults to 200.

  • shrink: Occasionally, you may find that a particular artist tends to create very long MIDI files. Use this property to essentially divide the start time of each note by a value. Default here is 1 (real-time), and higher values will shorten the song.

  • req: For very complex midis, or groups of midis with more than 16 total instruments, Musikov can only include up to 16. Right now, it randomly picks instruments to include. However, if you really want your song to include particular instruments, you can include an array with those here as either:

    • Instrument names (i.e.,['church organ']);
    • Instrument number from the MIDI specification (i.e.,['19']);
  • grp: Use this to treat groups of notes (anywhere from 1 to 10) as ONE markov item. This increases match accuracy, but also decreases number of matches. Best for really long samples.

So the correct format is:

Musikov.doSongs('beethoven',{ dir:'./allMySongs/', res:5, len:150, shrink:2, grp:3 });

for a folder of songs by beethoven (presumably), in a directory allSongs, with a resolution of 5, a length of 150 notes, a shrink amount of 2, and a group size of 3. Note that the parameters above can be included in any order, so doSongs({res:2},'mozart') works too.

##Restrictions: This is still a work in progress, and as such there are few notable restrictions the use of this app.

  1. The particular version of the MIDI format I'm using can only handle a maximum of 16 instrument types at once. If you've got more than that, you'll either need to be okay with randomly-chosen instruments or include a required parameter as above.
  2. You may find instances of prolonged silence (i.e., no notes playing). I'm not really sure how to alleviate this problem, but for now, just fast-forward a bit. Including a shrink parameter as described above can help.
  3. Occasionally, the module crashes. If this happens, just restart your app, and run Musikov again. Since apparently turning things off and then on again is a valid debugging strategy.

##License: Eh, do whatever you want. Seriously. I give you permsission.

##Credits:

  • I, David Newman, made this module. So any fault for broken stuff goes to me.
  • MidiConvert, which I use to read the MIDI files, was created by Gilles Piou. MidiConvert itself is a fork of ToneJs's MidiConvert.
  • jsmidgen, used to write the resulting MIDI files.
  • Directory tree parsing is provided by the aptly-named directory-tree module, which converts directory structures to nice, easy JSON.
  • Q and Chalk from their respective creators too.