{"id":18645153,"url":"https://github.com/danigb/binary-scale","last_synced_at":"2025-11-05T03:30:26.757Z","repository":{"id":34894890,"uuid":"38923659","full_name":"danigb/binary-scale","owner":"danigb","description":"All the 2048 western well tempered scales in all its glory","archived":false,"fork":false,"pushed_at":"2015-09-12T11:12:09.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T12:49:55.554Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danigb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-11T11:32:42.000Z","updated_at":"2015-07-21T12:42:17.000Z","dependencies_parsed_at":"2022-09-15T22:22:58.815Z","dependency_job_id":null,"html_url":"https://github.com/danigb/binary-scale","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fbinary-scale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fbinary-scale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fbinary-scale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fbinary-scale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danigb","download_url":"https://codeload.github.com/danigb/binary-scale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239449552,"owners_count":19640532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T06:14:51.150Z","updated_at":"2025-11-05T03:30:26.705Z","avatar_url":"https://github.com/danigb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# binary-scale\n\nA (western well tempered) scale implemented with binary numbers.\n\n## Deprecated: the code of this library is now part of [tonal](https://github.com/danigb/tonal)\n\n## Usage\n\nInstall the module: `npm install binary-scale --save` and use it:\n\n```js\nvar Scale = require('binary-scale')\nvar major = Scale(2773)\nmajor.binary // =\u003e '101011010101'\nmajor.length // =\u003e 7 (7 note scale)\nmajor.steps // =\u003e [2, 2, 1, 2, 2, 2, 1] (the distance in semitones between notes)\n```\n\n## API: Scale(number)\n\nThe method receives an integer and returns an object with the following attributes:\n\n- decimal: the scale decimal equivalent to the binary representation\n- binary: a string with the binary representation\n- length: the number of notes of this scale\n- steps: an array with the distance in semitones between the notes of the scale\n- leap: the maximum distance between notes of the scale\n- modes: an array of binary strings with all the possible modes of this scale\n- rootMode: a binary string representing the root mode that generates the rest of the modes. The rootMode of all the modes of the same scale is the same\n\nIf the number is below Scale.MIN or bigger than Scale.MAX an exception is thrown.\n\n## Theory and inspiration\n\n`binary-scale` is inspired by the works of [Rich Cochrane](http://cochranemusic.com), [Walter Zettel](http://www.muzuu.org/new_life/pics/simpleblog/scales/scalesadvice.html) and [William Zeitler](http://www.allthescales.org/)\n\n\n### Binary representations of scales\n\nThis is a implementation of binary scales as presented in the awesome book [Arpeggio \u0026 Scale Resources](https://archive.org/details/ScaleAndArpeggioResourcesAGuitarEncyclopedia) by Rich Cochrane, chapter 18.\n\nThe 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!)\n\n\u003e 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. A `1` in that position means the note is included in the scale and a `0` means it is not included. So we have:\n\n```\n1   0   1   0   1   1    0   1   0   1   0   1\n1  b2   2  b3   3   4   b5   5  b6   6  b7   7\n```\n\n### Why 2048 scales?\n\nAll the scales have root, so the smallest scale is '100000000000' (2048) and\nthe biggest is '111111111111' (4095), so the total number is 2048 (4096 - 2048)\n\nMost of they are not interesting enough to be used in music.\nFor example, in the [allthescales.org site](http://allthescales.org) they limit all the possibilities to those with leap \u003c 5 (1490)\n\n### Scale modes\n\n\u003e 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:\n\n```\n101011010101 // ionian\n010110101011\n101101010110 // dorian\n011010101101\n110101011010 // phrygian\n101010110101 // lydian\n010101101011\n101011010110 // mixolydian\n010110101101\n101101011010 // aeolian\n011010110101\n110101101010 // locrian\n```\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fbinary-scale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanigb%2Fbinary-scale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fbinary-scale/lists"}