@dsebastien/music-notation 0.14.0 → 0.16.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 -1
- package/dist/blocks/renderers.d.ts +17 -0
- package/dist/fretboard/fretboard.d.ts +5 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7849 -6924
- package/dist/index.js.map +30 -28
- package/dist/keyboard/keyboard.d.ts +5 -0
- package/dist/music-notation.css +59 -0
- package/dist/music-notation.publish.min.js +90 -27
- package/dist/music-notation.tab.min.js +66 -7
- package/dist/publish/auto.d.ts +3 -0
- package/dist/publish/index.js +7775 -6921
- package/dist/publish/index.js.map +30 -28
- package/dist/render/dom.d.ts +0 -1
- package/dist/render/pick.d.ts +82 -0
- package/dist/render/render-block.d.ts +3 -0
- package/dist/tab/index.js +1626 -1231
- package/dist/tab/index.js.map +8 -7
- package/dist/theory/naming.d.ts +64 -0
- package/dist/theory/note-set.d.ts +2 -0
- package/dist/voicings/index.js +1211 -750
- package/dist/voicings/index.js.map +9 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,6 +166,8 @@ 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
|
+
- Note names in solfège (Do Ré Mi) or German (H for B): `naming: solfege` or `naming: german` in a block, or as an option; notes may be written in any of the three systems.
|
|
170
|
+
- 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
171
|
- Styles: `injectStyles(document)`, or ship `@dsebastien/music-notation/music-notation.css`. Colors follow Obsidian's theme variables, with fallbacks for any page.
|
|
170
172
|
|
|
171
173
|
## Check your notes
|
|
@@ -184,7 +186,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
184
186
|
|
|
185
187
|
```js
|
|
186
188
|
;(() => {
|
|
187
|
-
const VERSION = '0.
|
|
189
|
+
const VERSION = '0.14.0'
|
|
188
190
|
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
189
191
|
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
190
192
|
const BLOCKS = selector([
|
|
@@ -1,3 +1,9 @@
|
|
|
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';
|
|
6
|
+
import type { Naming } from '../theory/naming.js';
|
|
1
7
|
import type { VoicingLookup } from '../voicings/index.js';
|
|
2
8
|
import type { PlayOptions } from '../playback/controls.js';
|
|
3
9
|
import { type LayoutDefaults } from '../render/layout.js';
|
|
@@ -34,6 +40,17 @@ export interface RenderOptions extends LayoutDefaults {
|
|
|
34
40
|
* `pre > code.language-tab`, which the tab bundle draws on web pages.
|
|
35
41
|
*/
|
|
36
42
|
tab?: (source: string, holder: HTMLElement) => (() => void) | void;
|
|
43
|
+
/**
|
|
44
|
+
* The pick layer on `fretboard` and `keyboard` blocks (Music Practice #73): every string ×
|
|
45
|
+
* fret and every key is a target that a click or the keyboard picks (`onPick`); those
|
|
46
|
+
* diagrams are not playable. Off by default.
|
|
47
|
+
*/
|
|
48
|
+
pick?: boolean | PickOptions;
|
|
49
|
+
/**
|
|
50
|
+
* How note names show (#12): `letters` (default), `solfege` (Do Ré Mi) or `german` (H for B).
|
|
51
|
+
* A block's `naming:` line wins. Input reads all three.
|
|
52
|
+
*/
|
|
53
|
+
naming?: Naming;
|
|
37
54
|
}
|
|
38
55
|
export type Renderer = (doc: Document, source: string, options: RenderOptions) => Element;
|
|
39
56
|
/** 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,8 @@ 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 { NAMINGS, parseNaming, namingOf, toLetters, lettersInBlock, quoteAsWritten, noteInNaming, chordInNaming, shownText, withNaming, type Naming, type BlockReading } from './theory/naming.js';
|
|
19
|
+
export { attachPick, type Pick, type PickAt, type PickLayer, type PickOptions, type PickResult } from './render/pick.js';
|
|
18
20
|
export { parseTuning } from './fretboard/tuning.js';
|
|
19
21
|
export { parseChordPro, parseLyrics, type Song, type Section, type Line, type Segment, type ChordDefinition } from './chords/chordpro.js';
|
|
20
22
|
export { renderChart, chartChords, type ChartChords, type ChartOptions } from './chords/chart.js';
|
|
@@ -24,7 +26,7 @@ export { parseChord, type ParsedChord } from './theory/chord-symbol.js';
|
|
|
24
26
|
export { chromaOf, midiOf, nameOf, noteOf, isFlat, SHARP_NAMES, FLAT_NAMES } from './theory/pitch.js';
|
|
25
27
|
export { transposeChord, transposeKey, keyPrefersFlats, keyMove } from './theory/transpose.js';
|
|
26
28
|
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';
|
|
29
|
+
export { chordNoteSet, scaleNoteSet, listNoteSet, emptyNoteSet, memberOf, labelOf, intervalLabel, type NoteSet, type NoteSetMember, type NoteLabel } from './theory/note-set.js';
|
|
28
30
|
export type { VoicingLookup } from './voicings/index.js';
|
|
29
31
|
export { parseChordName, readChord, suggestChords } from './theory/chord-name.js';
|
|
30
32
|
export { detectChordFromFrets, detectChordFromPitches, type DetectedChord } from './theory/detect.js';
|