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

tonal-note

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-note - npm Package Compare versions

Comparing version 1.0.0-0 to 1.0.0-1

build/transpiled.js

17

index.js

@@ -49,3 +49,4 @@ /**

chroma: null,
midi: null
midi: null,
freq: null
});

@@ -66,2 +67,3 @@

p.midi = p.oct !== null ? SEMI[p.step] + p.alt + 12 * (p.oct + 1) : null;
p.freq = midiToFreq(p.midi);
return Object.freeze(p);

@@ -127,4 +129,11 @@ };

export const midiToFreq = midi =>
typeof midi === "number" ? Math.pow(2, (midi - 69) / 12) * 440 : null;
/**
* Get the frequency from midi number
*
* @param {Number} midi - the note midi number
* @param {Number} tuning - (Optional) 440 by default
* @return {Number} the frequency or null if not valid note midi
*/
export const midiToFreq = (midi, tuning = 440) =>
typeof midi === "number" ? Math.pow(2, (midi - 69) / 12) * tuning : null;

@@ -141,3 +150,3 @@ /**

*/
export const freq = note => midiToFreq(props(note).midi) || midiToFreq(note);
export const freq = note => props(note).freq || midiToFreq(note);

@@ -144,0 +153,0 @@ const L2 = Math.log(2);

{
"name": "tonal-note",
"version": "1.0.0-0",
"version": "1.0.0-1",
"repository": "https://github.com/danigb/tonal/packages/note",

@@ -11,3 +11,3 @@ "description": "Encode pitches using fifths/octaves",

},
"main": "build/index.js",
"main": "build/transpiled.js",
"module": "index",

@@ -14,0 +14,0 @@ "author": "danigb",

@@ -14,2 +14,17 @@ /* global describe test expect */

test("props", () => {
expect(note.props("C#3")).toEqual({
acc: "#",
alt: 1,
chroma: 1,
letter: "C",
name: "C#3",
oct: 3,
pc: "C#",
step: 0,
midi: 49,
freq: 138.59131548843604
});
});
test("isNote", () => {

@@ -57,3 +72,3 @@ expect(note.isNote("c")).toBe(true);

test("toFreq", () => {
test("freq", () => {
expect(note.freq("A4")).toBe(440);

@@ -60,0 +75,0 @@ expect(note.freq(69)).toBe(440);

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