@dsebastien/music-notation 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/blocks/renderers.d.ts +11 -0
- package/dist/fretboard/fretboard.d.ts +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6020 -5313
- package/dist/index.js.map +20 -17
- package/dist/keyboard/keyboard.d.ts +5 -0
- package/dist/music-notation.css +152 -50
- package/dist/music-notation.publish.min.js +179 -77
- package/dist/music-notation.tab.min.js +159 -57
- package/dist/playback/bar-parts.d.ts +46 -0
- package/dist/playback/block-bar.d.ts +80 -0
- package/dist/playback/controls.d.ts +32 -9
- package/dist/playback/progression-bar.d.ts +3 -2
- package/dist/playback/strum-bar.d.ts +4 -4
- package/dist/publish/index.js +5849 -5246
- package/dist/publish/index.js.map +20 -17
- package/dist/render/dom.d.ts +2 -0
- package/dist/render/pick.d.ts +82 -0
- package/dist/render/render-block.d.ts +3 -0
- package/dist/tab/index.js +5 -1
- package/dist/tab/index.js.map +4 -4
- package/dist/theory/note-set.d.ts +2 -0
- package/dist/voicings/index.js +5 -1
- package/dist/voicings/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ if (!result.ok) console.warn(result.error)
|
|
|
158
158
|
|
|
159
159
|
- `renderBlock(language, source, host, options)` appends the rendering to `host` and never throws. It returns `{ ok, el, error, destroy() }`.
|
|
160
160
|
- `@dsebastien/music-notation/voicings` adds about 1,800 guitar voicings, found by chord symbol (`chord` blocks with only a symbol). It's a separate entry point because the data weighs about 230 KB.
|
|
161
|
-
- **Hear the diagrams**: the `play` option
|
|
161
|
+
- **Hear the diagrams**: with the `play` option, a click on a diagram plays it and a click on a dot or a key plays that note; one bar under each block plays the selected diagram or all of them in turn, with loop, speed and the sound (the volume is the app's setting). Guitar chords strum, piano chords strike as a block, scales run from their tonic up and back. While it plays, each note lights up on the drawing when you hear it.
|
|
162
162
|
- **Strumming patterns**: `strum` blocks draw a pattern (`D DU UDU`, `D - D U - U D U`) on a beat grid with counts, accents, muted and ghost strums and chord changes; with playback on, they play over their chords, with loop, tempo and a count-in. `playStrum(pattern, { bpm, chord, tuning })` plays one from code.
|
|
163
163
|
- **Practice in time**: `progression` blocks and ChordPro charts get a bar that plays their chords in time, one chord a bar (or as a chart's bar lines say), with a metronome click, a count-in and a loop. Each chord is strummed on the beats, once a bar, as an arpeggio or to a strumming pattern, and the chord playing lights up. `playProgression(chords, { bpm, strum, pattern, click, countIn, loop })` does it from code, with your own player.
|
|
164
164
|
- **Harmonize a scale**: a `progression` block with `harmonize: triads`, `sevenths`, `sus` or `power` and any 7-note scale as its `key:` (`A harmonic minor`, `D dorian`) draws the chord on each degree with its numeral and a diagram, ready to play in time. `harmonize(scale, { kind })` gives the same chords from code.
|
|
@@ -166,6 +166,7 @@ if (!result.ok) console.warn(result.error)
|
|
|
166
166
|
- **Tabs and scores**: `@dsebastien/music-notation/tab` draws `tab` and `score` blocks (alphaTex, or Guitar Pro and MusicXML files) with [alphaTab](https://alphatab.net), and adds a player. It also converts score files, text tabs and chord sheets, and exports Guitar Pro 7 and MIDI.
|
|
167
167
|
- `generateVoicings(symbol, options)` finds every playable voicing of a chord on any tuning, easiest first, with fingers and shape names; `fingerVoicing(frets)` fingers any voicing. `fingeringInWords(chord)` writes a guitar or piano chord's fingering in plain sentences, as `caption: fingering` shows it under a diagram.
|
|
168
168
|
- The renderers (`renderGuitarDiagram`, `renderKeyboard`, `renderFretboard`, `renderChart`, `renderStrum`, `renderPicking`, `renderCircle`), the parsers and the theory helpers (`parseChord`, `transposeChord`, `chordNoteSet`, `scaleNoteSet`…) are exported too.
|
|
169
|
+
- A pick layer for drills: with `pick`, every string × fret of a fretboard and every key of a keyboard is a target that a click or the keyboard picks; the app marks picks right or wrong (`attachPick`).
|
|
169
170
|
- Styles: `injectStyles(document)`, or ship `@dsebastien/music-notation/music-notation.css`. Colors follow Obsidian's theme variables, with fallbacks for any page.
|
|
170
171
|
|
|
171
172
|
## Check your notes
|
|
@@ -184,7 +185,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
184
185
|
|
|
185
186
|
```js
|
|
186
187
|
;(() => {
|
|
187
|
-
const VERSION = '0.
|
|
188
|
+
const VERSION = '0.14.0'
|
|
188
189
|
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
189
190
|
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
190
191
|
const BLOCKS = selector([
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One renderer per block language. Each takes the block's source and returns the element to
|
|
3
|
+
* show, or throws an Error whose message is meant for the user.
|
|
4
|
+
*/
|
|
5
|
+
import type { PickOptions } from '../render/pick.js';
|
|
1
6
|
import type { VoicingLookup } from '../voicings/index.js';
|
|
2
7
|
import type { PlayOptions } from '../playback/controls.js';
|
|
3
8
|
import { type LayoutDefaults } from '../render/layout.js';
|
|
@@ -34,6 +39,12 @@ export interface RenderOptions extends LayoutDefaults {
|
|
|
34
39
|
* `pre > code.language-tab`, which the tab bundle draws on web pages.
|
|
35
40
|
*/
|
|
36
41
|
tab?: (source: string, holder: HTMLElement) => (() => void) | void;
|
|
42
|
+
/**
|
|
43
|
+
* The pick layer on `fretboard` and `keyboard` blocks (Music Practice #73): every string ×
|
|
44
|
+
* fret and every key is a target that a click or the keyboard picks (`onPick`); those
|
|
45
|
+
* diagrams are not playable. Off by default.
|
|
46
|
+
*/
|
|
47
|
+
pick?: boolean | PickOptions;
|
|
37
48
|
}
|
|
38
49
|
export type Renderer = (doc: Document, source: string, options: RenderOptions) => Element;
|
|
39
50
|
/** Renders one diagram from a parsed block (the parts of a row share settings, see renderBlock). */
|
|
@@ -28,5 +28,10 @@ export interface FretboardOptions {
|
|
|
28
28
|
* and nothing behind it is shown.
|
|
29
29
|
*/
|
|
30
30
|
fretsFrom?: 'capo' | 'nut';
|
|
31
|
+
/**
|
|
32
|
+
* The pick layer (Music Practice #73): every string × fret shown is a target with its string,
|
|
33
|
+
* fret, note and pitch, drawn above the dots; `attachPick` makes it live. Off by default.
|
|
34
|
+
*/
|
|
35
|
+
pick?: boolean;
|
|
31
36
|
}
|
|
32
37
|
export declare function renderFretboard(doc: Document, set: NoteSet, options?: FretboardOptions): SVGElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { renderKeyboard, parseKeyRange, keyRangeOf, type KeyboardOptions } from
|
|
|
15
15
|
export { pianoVoicing, pianoPitches, triadFingering, type PianoVoicing, type PianoVoicingOptions, type PianoVoicingStyle, type PianoHands, type RootlessForm, type ShellForm } from './keyboard/piano-chord.js';
|
|
16
16
|
export { standardScaleFingering, scaleFingers, type ScaleHand } from './keyboard/scale-fingering.js';
|
|
17
17
|
export { renderFretboard, type FretboardOptions } from './fretboard/fretboard.js';
|
|
18
|
+
export { attachPick, type Pick, type PickAt, type PickLayer, type PickOptions, type PickResult } from './render/pick.js';
|
|
18
19
|
export { parseTuning } from './fretboard/tuning.js';
|
|
19
20
|
export { parseChordPro, parseLyrics, type Song, type Section, type Line, type Segment, type ChordDefinition } from './chords/chordpro.js';
|
|
20
21
|
export { renderChart, chartChords, type ChartChords, type ChartOptions } from './chords/chart.js';
|
|
@@ -24,7 +25,7 @@ export { parseChord, type ParsedChord } from './theory/chord-symbol.js';
|
|
|
24
25
|
export { chromaOf, midiOf, nameOf, noteOf, isFlat, SHARP_NAMES, FLAT_NAMES } from './theory/pitch.js';
|
|
25
26
|
export { transposeChord, transposeKey, keyPrefersFlats, keyMove } from './theory/transpose.js';
|
|
26
27
|
export type { KeyMove } from './theory/transpose.js';
|
|
27
|
-
export { chordNoteSet, scaleNoteSet, listNoteSet, memberOf, labelOf, intervalLabel, type NoteSet, type NoteSetMember, type NoteLabel } from './theory/note-set.js';
|
|
28
|
+
export { chordNoteSet, scaleNoteSet, listNoteSet, emptyNoteSet, memberOf, labelOf, intervalLabel, type NoteSet, type NoteSetMember, type NoteLabel } from './theory/note-set.js';
|
|
28
29
|
export type { VoicingLookup } from './voicings/index.js';
|
|
29
30
|
export { parseChordName, readChord, suggestChords } from './theory/chord-name.js';
|
|
30
31
|
export { detectChordFromFrets, detectChordFromPitches, type DetectedChord } from './theory/detect.js';
|