
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
binary-scale
Advanced tools
A (western well tempered) scale implemented with binary numbers.
IMPORTANT: This is a low-level library. Probably you'll use music-scale
You can see a demo here: http://danigb.github.io/scales
Install the module: npm install binary-scale --save
and use it:
var Scale = require('binary-scale')
var major = Scale(2773)
major.binary // => '101011010101'
major.length // => 7 (7 note scale)
major.steps // => [2, 2, 1, 2, 2, 2, 1] (the distance in semitones between notes)
The method receives an integer and returns an object with the following attributes:
If the number is below Scale.MIN or bigger than Scale.MAX an exception is thrown.
binary-scale
is inspired by the works of Rich Cochrane, Walter Zettel and William Zeitler
This is a implementation of binary scales as presented in the awesome book Arpeggio & Scale Resources by Rich Cochrane, chapter 18.
The following explanation is extracted from the book. (The book has a Creative Commons Usage Attribution-Noncommercial-No Derivative Works 3.0... thanks a lot Rich!)
The major scale is
1 0 1 0 1 1 0 1 0 1 0 1
. This number (2773 in decimal, see previous example) uniquely represents the Major scale. The method of representation is simple: each position, reading left to right, represents a note: 1, b2, 2 and so on. A1
in that position means the note is included in the scale and a0
means it is not included. So we have:
1 0 1 0 1 1 0 1 0 1 0 1
1 b2 2 b3 3 4 b5 5 b6 6 b7 7
All the scales have root, so the smallest scale is '100000000000' (2048) and the biggest is '111111111111' (4095), so the total number is 2048 (4096 - 2048)
Most of they are not interesting enough to be used in music. For example, in the allthescales.org site they limit all the possibilities to those with leap < 5 (1490)
Note that modes of a scale are obtained by the technique known as 'bit rotation'. We would normally eliminate all those rows that begin with a zero, since they don't contain a root note:
101011010101 // ionian
010110101011
101101010110 // dorian
011010101101
110101011010 // phrygian
101010110101 // lydian
010101101011
101011010110 // mixolydian
010110101101
101101011010 // aeolian
011010110101
110101101010 // locrian
MIT License
FAQs
A musical scale implemented with binary numbers
The npm package binary-scale receives a total of 3 weekly downloads. As such, binary-scale popularity was classified as not popular.
We found that binary-scale 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.