Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
binary-scale
Advanced tools
Readme
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 1 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.