Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
A set of utilities for working with musical notes, frequencies, and chords
Octavian is a little utility library for working with musical notes and their frequencies. Super cool, right?
First things, first: how do I install this thing?
npm install octavian
Maybe you even throw a --save
in there if you feel like keeping it around.
So, we've got Octavian installed, how do we use it?
var Octavian = require('octavian');
var note = new Octavian.Note('A4');
Or, if you're some kind of hipster…
var Note = require('octavian').Note;
var note = new Note('A4');
A Note
has a few properties that we can play around with.
var note = new Note('A#4');
note.letter; // 'A'
note.modifier; // '#'
note.octave; // 4
note.signature; // 'A#4'
note.pianoKey; // 50
note.frequency; // 466.164
But, what if we toss in some bogus note? Something like E#
, maybe? There is no E#
, right?
var note = new Note('E#5');
note.signature; // 'F5'
Music is all about intervals. We can move up by a semitone or some other interval.
var note = new Note('C3');
note.majorThird(); // returns a new Note('E3');
note.perfectFifth(); // returns a new Note('G3');
note.perfectOctave(); // returns a new Note('C4');
You can do any of the following:
downOctave()
minorSecond()
majorSecond()
minorThird()
majorThird()
perfectFourth()
diminishedFifth()
perfectFifth()
minorSixth()
majorSixth()
minorSeventh()
majorSeventh()
perfectOctave()
There are also some extra methods that are aliased, if you'd prefer:
augmentedFourth()
third()
fifth()
You can create chords with Octavian.
const cMajorChord = new Octavian.Chord('C4', 'major');
cMajorChord.notes; // returns [ { letter: 'C', modifier: null, octave: 4 },
// { letter: 'E', modifier: null, octave: 4 },
// { letter: 'G', modifier: null, octave: 4 } ]
cMajorChord.signatures; // returns [ 'C4', 'E4', 'G4' ]
cMajorChord.frequencies; // returns [ 261.626, 329.628, 391.995 ]
cMajorChord.pianoKeys; // returns [ 40, 44, 47 ]
You can create the following chords:
major
majorSixth
majorSeventh
majorSeventhFlatFive
majorSeventhSharpFive
minor
minorSixth
minorSeventh
minorMajor
dominantSeventh
diminished
diminishedSeventh
halfDimished
You're also more than welcome to use the following aliases for any of the above:
maj
is an alias for major
6
is an alias for majorSixth
maj6
is an alias for majorSixth
7
is an alias for majorSeventh
maj7
is an alias for majorSeventh
maj7b5
is an alias for majorSeventhFlatFive
maj7#5
is an alias for majorSeventhSharpFive
min
is an alias for minor
m
is an alias for minor
min6
is an alias for minorSixth
m6
is an alias for minorSixth
min7
is an alias for minorSeventh
m7
is an alias for minorSeventh
m#7
is an alias for minorMajor
min#7
is an alias for minorMajor
m(maj7)
is an alias for minorMajor
dom7
is an alias for dominantSeventh
dim
is an alias for diminished
dim7
is an alias for diminishedSeventh
m7b5
is an alias for halfDiminshed
You can add notes to a chord manually, if that suits you:
const chord = new Octavian.Chord('C4');
chord.signatures; // returns ['C4']
chord.addInterval('majorThird');
chord.signatures; // returns ['C4', 'E4']
chord.addInterval(7);
chord.signatures; // returns ['C4', 'E4', 'G4']
You can turn any note into the basis for a chord:
const note = new Octavian.Note('C4');
note.toChord(); // returns a new chord with only C4 in it.
note.toChord('major'); // returns a new chord with C4, E4, and G4 in it
FAQs
A set of utilities for working with musical notes, frequencies, and chords
The npm package octavian receives a total of 2 weekly downloads. As such, octavian popularity was classified as not popular.
We found that octavian demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.