scale-slayer
v2.0.0
Published
Interactive guitar fretboard for learning scales, CAGED positions and the notes on the neck. Works on phones.
Maintainers
Readme
Scale Slayer
An interactive guitar neck for learning scales. Pick a key and a scale, and it shows every note across 22 frets, split into the five positions guitarists learn. You can hear the positions played, switch the labels to scale degrees, and drill yourself with a quick quiz.
It works on phones. In a narrow space the neck turns vertical, like a chord chart, so the notes stay big enough to read and tap.
Try it at scale-slayer.vercel.app.
Install
npm install scale-slayerReact 18 or newer is a peer dependency.
Use
import { ScaleSlayer } from 'scale-slayer';
import 'scale-slayer/style.css';
export function Practice() {
return <ScaleSlayer headingLevel={2} />;
}Import the stylesheet once. Every class is scoped under .ss-root, so it won't touch the rest of
your page.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| headingLevel | 1 to 6 | 1 | Level of the "Scale Slayer" heading, so it fits your page outline. |
| showTitle | boolean | true | Hide the heading when your page already names the section. |
| standalone | boolean | false | Keeps the settings in the page URL so a view can be shared. Leave off when embedding. |
| orientation | 'auto' \| 'horizontal' \| 'vertical' | 'auto' | auto turns the neck vertical when the component is narrower than 820px. It measures its own width, not the screen's. |
| defaultRoot | Note | Note.CSharp | Key shown at start. |
| defaultScale | Scale | Scale.PentatonicMinor | Scale shown at start. |
| defaultPositions | number[] | [2, 4] | Positions shown at start, numbered 1 to 5. |
| className | string | | Extra class on the root element. |
Each <ScaleSlayer> keeps its own state, so you can put more than one on a page.
Scales
Minor pentatonic, major pentatonic, blues, major, natural minor, harmonic minor, melodic minor, Dorian, Phrygian, Lydian, Mixolydian and Locrian, in all twelve keys.
Pentatonic and blues scales use the five standard pentatonic boxes. The seven-note scales use the five CAGED shapes of their parent major scale. Position 1 is always the shape that starts on the root on the low E string.
Practice features
- Degrees. Switch note names to scale degrees (1, b3, 4 and so on). The root is ringed.
- Hear it. Tap any note to hear it. Play positions runs the selected positions up and down in time, lighting each note as it sounds.
- Metronome with an accented first beat, from 30 to 300 BPM.
- Quiz. "Find the note" asks for a named note anywhere on the neck. "Find the degree" asks for a degree of the current scale in the positions you have selected. Ten questions per round, scored on first-time answers.
Theming
Override the custom properties on .ss-root, for example:
.ss-root {
--ss-bg: #101010;
--ss-accent: #00c7be;
--ss-accent-ink: #00201f;
}The full list is at the top of scale-slayer/style.css. The defaults meet WCAG AA contrast.
The music engine
The scale maths is exported too, if you want it without the component:
import { Note, Scale, scaleNotes, scalePositions, degreeOf } from 'scale-slayer';
scaleNotes(Note.A, Scale.Dorian); // A B C D E F# G
degreeOf(Note.C, Note.A, Scale.Minor); // 'b3'
scalePositions(Note.G, Scale.Major)[0]; // notes in the first CAGED shapeUpgrading from 1.x
- Import
scale-slayer/style.css. Version 1 used inline styles. - The component no longer renders a
<main>element. PassheadingLevelto set the heading level. GuitarFretboardstill works as an alias forScaleSlayer.- Tone.js is gone, so the package is about 38 kB instead of 438 kB.
Develop
npm install
npm run dev # standalone site at http://localhost:5173
npm test # unit and component tests
npm run build:lib # package build into dist/
npm run build # standalone site build into dist-site/License
MIT
