New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonal-pitch

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-pitch - npm Package Compare versions

Comparing version 0.66.0 to 0.69.0

coverage/clover.xml

40

build/index.js

@@ -10,2 +10,12 @@ 'use strict';

/**
* Functions to deal with pitches (either notes or intervals).
*
* This functions are very low level and more developer friendly of this functions
* are exposed in the note and interval packages. It's unlikely you need them.
* That's why __this module is NOT exported in the tonal package__.
*
* @private
* @module pitch
*/
/**
* Create a pitch

@@ -108,3 +118,3 @@ * @param {Integer} fifths - the number of fifths from C or from P1

function chr (p) {
var f = fifths(p)
var f = fifths(p);
return 7 * f - 12 * Math.floor(f * 7 / 12)

@@ -115,3 +125,3 @@ }

function memoize (fn) {
var cache = {}
var cache = {};
return function (str) {

@@ -130,5 +140,5 @@ if (typeof str !== 'string') return null

var parseNote = memoize(function (s) {
var p = noteParser.parse(s)
var p = noteParser.parse(s);
return p ? encode$1(p.step, p.alt, p.oct) : null
})
});

@@ -142,6 +152,6 @@ /**

var parseIvl = memoize(function (s) {
var p = intervalNotation.parse(s)
var p = intervalNotation.parse(s);
if (!p) return null
return p ? encode$1(p.simple - 1, p.alt, p.oct, p.dir) : null
})
});

@@ -195,5 +205,5 @@ /**

// decode to [step, alt, oct]
var d = decode$1(p)
var d = decode$1(p);
// d = [step, alt, oct]
var num = d[0] + 1 + 7 * d[2]
var num = d[0] + 1 + 7 * d[2];
return p[2] * num + intervalNotation.altToQ(num, d[1])

@@ -212,10 +222,10 @@ }

// string representations
function decorator (is, parse, str) {
function decorator (is, parse$$1, str) {
return function (fn) {
return function (v) {
var i = is(v)
var i = is(v);
// if the value is in pitch notation no conversion
if (i) return fn(v)
// else parse the pitch
var p = parse(v)
var p = parse$$1(v);
// if parsed, apply function and back to string

@@ -235,3 +245,3 @@ return p ? str(fn(p)) : null

*/
var noteFn = decorator(isNotePitch, parseNote, strNote)
var noteFn = decorator(isNotePitch, parseNote, strNote);
/**

@@ -245,3 +255,3 @@ * Decorate a function to work internally with interval pitches, even if the

*/
var ivlFn = decorator(isIvlPitch, parseIvl, strIvl)
var ivlFn = decorator(isIvlPitch, parseIvl, strIvl);
/**

@@ -255,3 +265,3 @@ * Decorate a function to work internally with pitches, even if the

*/
var pitchFn = decorator(isPitch, parsePitch, strPitch)
var pitchFn = decorator(isPitch, parsePitch, strPitch);

@@ -282,2 +292,2 @@ exports.pitch = pitch;

exports.ivlFn = ivlFn;
exports.pitchFn = pitchFn;
exports.pitchFn = pitchFn;
{
"name": "tonal-pitch",
"version": "0.66.0",
"version": "0.69.0",
"description": "Music pitch utilities",

@@ -13,3 +13,3 @@ "keywords": [

"pretest": "rollup -f cjs -o build/index.js -- index.js",
"test": "tape test/*.js"
"test": "jest --coverage"
},

@@ -24,4 +24,4 @@ "main": "build/index.js",

"note-parser": "^2",
"tonal-encoding": "^0.66.0"
"tonal-encoding": "^0.69.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc