From e397b62757ba61dac8958ee93c73a503192f5798 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 11 Oct 2026 11:35:07 +0000 Subject: [PATCH] Draw a filled treble clef on each staff. The spiral sits on the G line, with the hook under the staff. The chart is a little wider so the holes stay the same size. Version 0.2.5. Co-authored-by: catpersonisme --- README.md | 10 +++--- package.json | 2 +- src/components/editor.tsx | 8 ++--- src/components/fingering-diagram.tsx | 46 +++++++++++++--------------- src/lib/notation.ts | 14 +++++++-- src/lib/png-layout.ts | 5 +-- 6 files changed, 46 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 2dcff4a..839289a 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ The usual way to run it is one Linux AppImage. That file contains the window and ## Run the AppImage ```bash -chmod +x Recorder-Tab-Converter-0.2.4.AppImage -./Recorder-Tab-Converter-0.2.4.AppImage +chmod +x Recorder-Tab-Converter-0.2.5.AppImage +./Recorder-Tab-Converter-0.2.5.AppImage ``` If the file will not start because FUSE is missing: ```bash -APPIMAGE_EXTRACT_AND_RUN=1 ./Recorder-Tab-Converter-0.2.4.AppImage +APPIMAGE_EXTRACT_AND_RUN=1 ./Recorder-Tab-Converter-0.2.5.AppImage ``` Open **Empty line**, or start from **Twinkle, opening** or **Ode, held note**. Drag any chart from C5 to D7, or drag **Rest** or **Space**, onto a line. Drag a placed item to move it, including onto another line. **New line** adds a row underneath. Plus and minus change the length. Remove takes an item off. **Shorter**, **Taller**, **Narrower**, **Wider**, and the corner grip change the box. **Save PNG** downloads every line. @@ -30,7 +30,7 @@ From a checkout, one command: That installs Node packages, builds the app, and writes: ```text -dist/Recorder-Tab-Converter-0.2.4.AppImage +dist/Recorder-Tab-Converter-0.2.5.AppImage ``` The AppImage is not committed. Keep it under 600MB. @@ -49,4 +49,4 @@ The dev server listens on [http://127.0.0.1:3847](http://127.0.0.1:3847). Baroque (English) fingerings are the first choice on the [Dolmetsch Online chart for recorders in C](https://dolmetsch.com/textfingeringchart.htm) (Brian Blood). The soprano is labeled in concert pitch: low C is C5, and the chart stops at D7. Double holes 6 and 7, forked F, and the second-octave thumb pinch are included. Alternate fingerings on that chart are not shown. -Each chart is drawn foot-up: holes 7 and 6 at the top, then 5 through 1, then the thumb. The tube ends there. A filled hole is closed. A treble staff under the holes is written one octave below the sounding pitch. Low C, labeled C5, sits on the ledger line below the staff. Sounding C6 is written C5, and sounding C7 is written C6. Length is a notehead, stem, flags, dots, and rests. Labels keep the sounding names. +Each chart is drawn foot-up: holes 7 and 6 at the top, then 5 through 1, then the thumb. The tube ends there. A filled hole is closed. A treble staff under the holes is written one octave below the sounding pitch. The staff opens with a filled treble clef, spiral on the G line. Low C, labeled C5, sits on the ledger line below the staff. Sounding C6 is written C5, and sounding C7 is written C6. Length is a notehead, stem, flags, dots, and rests. Labels keep the sounding names. diff --git a/package.json b/package.json index e230a89..507b30a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "recorder-tab-converter", - "version": "0.2.4", + "version": "0.2.5", "private": true, "description": "Arrange soprano recorder fingering charts by dragging them onto a line.", "main": "electron/main.cjs", diff --git a/src/components/editor.tsx b/src/components/editor.tsx index f47336b..dbc1936 100644 --- a/src/components/editor.tsx +++ b/src/components/editor.tsx @@ -24,7 +24,7 @@ import { type LineNote, type ScoreLine, } from "@/lib/line"; -import { chartPixelHeight } from "@/lib/notation"; +import { chartOuterWidth, chartPixelHeight } from "@/lib/notation"; import { pngFilename, PNG_CHART_WIDTH } from "@/lib/png-layout"; import { ChevronLeft, ChevronRight, Minus, Plus, X } from "lucide-react"; import { useEffect, useRef, useState, type PointerEvent as ReactPointerEvent, type ReactNode, type RefObject } from "react"; @@ -320,7 +320,7 @@ export function Editor() { }) } > - + {CHART_NOTES.map((pitch) => ( ) : null} {ghost.kind === "rest" ? : null} - {ghost.kind === "space" ? : null} + {ghost.kind === "space" ? : null} ) : null} @@ -610,7 +610,7 @@ function PlacedItem({ ) : null} {note.kind === "rest" ? : null} {note.kind === "space" ? ( - + ) : null}

{caption}

diff --git a/src/components/fingering-diagram.tsx b/src/components/fingering-diagram.tsx index 01f7910..f4eb29e 100644 --- a/src/components/fingering-diagram.tsx +++ b/src/components/fingering-diagram.tsx @@ -7,7 +7,9 @@ import { import { CHART_VB_H, CHART_VB_W, + chartOuterWidth, chartPixelHeight, + CLEF_GUTTER, dotIndex, ledgerIndexes, noteValue, @@ -66,8 +68,9 @@ export function FingeringDiagram({ width?: number; quarters?: number; }) { - const width = widthOverride ?? (size === "lead" ? 44 : 40); - const height = chartPixelHeight(width); + const bodyWidth = widthOverride ?? (size === "lead" ? 44 : 40); + const width = chartOuterWidth(bodyWidth); + const height = chartPixelHeight(bodyWidth); if (!fingering) { return (
+ + - + + + ); } -export function RestMark({ quarters = 1, width = 44 }: { quarters?: number; width?: number }) { - const height = chartPixelHeight(width); +export function RestMark({ quarters = 1, width: bodyWidth = 44 }: { quarters?: number; width?: number }) { + const width = chartOuterWidth(bodyWidth); + const height = chartPixelHeight(bodyWidth); const value = restValue(quarters); return ( - + + + ); } @@ -148,8 +158,8 @@ function Staff({ pitch }: { pitch?: string }) { {[0, 2, 4, 6, 8].map((index) => ( + + + ); } diff --git a/src/lib/notation.ts b/src/lib/notation.ts index 7dbcf2b..29507e0 100644 --- a/src/lib/notation.ts +++ b/src/lib/notation.ts @@ -1,7 +1,10 @@ import { quartersMatch } from "@/lib/duration"; /** The tube ends just below the thumb hole. The staff is added underneath. */ -export const CHART_VB_W = 48; +const CHART_BODY_W = 48; +/** Extra width on the left so the treble clef can sit on the G line. */ +export const CLEF_GUTTER = 6; +export const CHART_VB_W = CHART_BODY_W + CLEF_GUTTER; const RECORDER_VB_H = 152; /** Distance between two staff lines. One diatonic step is half of this. */ @@ -21,8 +24,13 @@ const BELOW = -LOW_INDEX * STEP + PAD_BOTTOM; export const BOTTOM_LINE_Y = RECORDER_VB_H + 3 + PAD_TOP + ABOVE; export const CHART_VB_H = Math.ceil(BOTTOM_LINE_Y + BELOW); -export function chartPixelHeight(width: number): number { - return Math.round((width * CHART_VB_H) / CHART_VB_W); +/** Pixel width of a chart once the clef gutter is included. Holes keep their old size. */ +export function chartOuterWidth(bodyWidth: number): number { + return Math.ceil((bodyWidth * CHART_VB_W) / CHART_BODY_W); +} + +export function chartPixelHeight(bodyWidth: number): number { + return Math.round((chartOuterWidth(bodyWidth) * CHART_VB_H) / CHART_VB_W); } export function staffY(index: number): number { diff --git a/src/lib/png-layout.ts b/src/lib/png-layout.ts index 1965714..78b41e6 100644 --- a/src/lib/png-layout.ts +++ b/src/lib/png-layout.ts @@ -1,5 +1,5 @@ import type { LineNote } from "@/lib/line"; -import { chartPixelHeight } from "@/lib/notation"; +import { chartOuterWidth, chartPixelHeight } from "@/lib/notation"; export const PNG_CHART_WIDTH = 88; const GAP = 18; @@ -20,12 +20,13 @@ export type PngItem = { }; export function pngItemFromNote(note: Pick, chartWidth = PNG_CHART_WIDTH): PngItem { + const drawn = chartOuterWidth(chartWidth); const glyphHeight = chartPixelHeight(chartWidth); const caption = note.kind === "note" ? note.pitch : note.kind === "rest" ? "Rest" : "Space"; return { kind: note.kind, caption, - glyphWidth: note.kind === "space" ? spacePixelWidth(note.quarters, chartWidth) : chartWidth, + glyphWidth: note.kind === "space" ? spacePixelWidth(note.quarters, drawn) : drawn, glyphHeight, }; }