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

underscore.music

v0.1.0

Published

Music manipulation extensions for Underscore.js javascript library.

Downloads

5

Readme

underscore.music

Music manipulation extensions for Underscore.js javascript library.

NPM Version Bower Build Status Coverage Status

Node.js Installation

$ npm install underscore.music

Integrate with Underscore.js

var _ = require("underscore");

// Import underscore.music to separate object
_.music = require("underscore.music");

// Mix in non-conflict functions to underscore namespace
_.mixin(_.music.exports());

Browser Installation

Bower

$ bower install underscore.music

Downloads

Integrate with Underscore.js

<script src="/path/to/underscore.js"></script>
<script src="/path/to/underscore.music.js"></script>
<script>
// Mix in non-conflict functions to underscore namespace
_.mixin(_.music.exports());
</script>

Music Functions

midicps _.midicps(midi: number): number

Convert MIDI note to cycles per second

_.midicps(69) // 440
_.midicps(76) // 659.2551138257398
_.midicps(81) // 880

mtof alias for midicps

cpsmidi _.cpsmidi(cps: number): number

Convert cycles per second to MIDI note

_.cpsmidi(440) // 69
_.cpsmidi(660) // 76.01955000865388
_.cpsmidi(880) // 81

ftom alias for cpsmidi

midiratio _.ratiomidi(midi: number): number

Convert an interval in semitones to a ratio

_.midiratio(0) // 1
_.midiratio(7) // 1.4983070768766815
_.midiratio(12) // 2

ratiomidi _.ratiomidi(ratio: number): number

Convert a ratio to an interval in semitone

_.ratiomidi(1) // 0
_.ratiomidi(2) // 12
_.ratiomidi(3) // 19.019550008653876

dbamp _.dbamp(db: number): number

Convert a decibels to a linear amplitude

_.dbamp(0) // 1
_.dbamp(3) // 1.4125375446227544
_.dbamp(6) // 1.9952623149688797

ampdb _.ampdb(amp: number): number

Convert a linear amplitude to decibels

_.ampdb(1) // 0
_.ampdb(3) // 6.020599913279624
_.ampdb(6) // 9.54242509439325

linlin _.linlin(value: number, inMin, inMax, outMin, outMax): number

Convert linear input range to a linear output range

_.linlin(0.00, 0, 1, 0, 1000) // 0
_.linlin(0.25, 0, 1, 0, 1000) // 250
_.linlin(0.50, 0, 1, 0, 1000) // 500
_.linlin(0.75, 0, 1, 0, 1000) // 750
_.linlin(1.00, 0, 1, 0, 1000) // 1000

linexp _.linexp(value: number, inMin, inMax, outMin, outMax): number

Convert linear input range to a exponential output range

_.linexp(0.00, 0, 1, 0.1, 1000) // 0.1
_.linexp(0.25, 0, 1, 0.1, 1000) // 1
_.linexp(0.50, 0, 1, 0.1, 1000) // 10
_.linexp(0.75, 0, 1, 0.1, 1000) // 100
_.linexp(1.00, 0, 1, 0.1, 1000) // 1000

explin _.explin(value: number, inMin, inMax, outMin, outMax): number

Convert exponential input range to a linear output range

_.explin(0.10, 0.1, 1, 0, 1000) // 0
_.explin(0.25, 0.1, 1, 0, 1000) // 397.9400086720376
_.explin(0.50, 0.1, 1, 0, 1000) // 698.9700043360187
_.explin(0.75, 0.1, 1, 0, 1000) // 875.0612633916999
_.explin(1.00, 0.1, 1, 0, 1000) // 1000

expexp _.expexp(value: number, inMin, inMax, outMin, outMax): number

Convert exponential input range to a exponential output range

_.expexp(0.10, 0.1, 1, 0.1, 1000) // 0
_.expexp(0.25, 0.1, 1, 0.1, 1000) // 3.90625
_.expexp(0.50, 0.1, 1, 0.1, 1000) // 62.49999999999997
_.expexp(0.75, 0.1, 1, 0.1, 1000) // 316.40624999999955
_.expexp(1.00, 0.1, 1, 0.1, 1000) // 1000

License

underscore.music is available under the The MIT License.