Skip to content

Bantar Builder: banjo → tār/setār fret calculator web app - #1

Draft
lanethefox wants to merge 5 commits into
mainfrom
claude/banjo-tar-fret-calculator-0zev9h
Draft

Bantar Builder: banjo → tār/setār fret calculator web app#1
lanethefox wants to merge 5 commits into
mainfrom
claude/banjo-tar-fret-calculator-0zev9h

Conversation

@lanethefox

Copy link
Copy Markdown
Owner

What this is

A self-contained browser tool for converting a fretless banjo (4- or 5-string) into an Americanized tār / setār, focused on the hardest part of that build: laying out and tying the gut frets. No dependencies, no build step — open index.html or python3 -m http.server.

Features

Instrument parameters — scale length, neck taper (nut/join width and thickness, since tied frets wrap the whole neck), materials (neck/head/bridge/nut), and Nylgut knot allowance. Banjo strings map onto Persian roles (sefid / zard / bam / vākhān / zang) via tuning presets, including "Americanized" presets pitched for Western jams.

To-scale fret diagram (SVG) — every tied fret at its true distance from the nut, color-coded by type (diatonic / koron / sori / chromatic), labelled in solfège + Western + Persian script. Wrap pips on the bass edge show how many times the gut goes around the neck.

All 12 dastgāh / āvāz — Māhur, Shur, Homāyun, Segāh, Chahārgāh, Navā, Rāst-Panjgāh + the five āvāz. Selecting a mode highlights the frets it needs and can auto-add them to the fret set.

Integrated chromatic tuner — Web Audio autocorrelation pitch detection; shows Hz, nearest note, cents off, and a plain-language adjustment. A marker rides the fret diagram at the heard pitch so you can slide each tied fret to pitch.

Fret cut & wrap chart — per fret: distance, spacing, neck cross-section, wrap count, exact Nylgut cut length, and a suggested gauge from your tenor stock. Total length, CSV export, printable shop sheet.

Generated assembly guide — parameter-aware order (reference frets first), knot direction, slide-to-tune method, fill-in order, overnight re-tune.

Math

  • Fret positions: generalized rule of 18, d = L·(1 − 2^(−cents/1200)) (verified: octave lands at exactly L/2).
  • Tie length: Ramanujan ellipse-perimeter of the neck cross-section × wraps + knot allowance.

Accuracy / scope

Uses a deliberate "Americanized" compromise: a 12-TET skeleton plus the principal Persian neutral tones (koron/sori) at sensible neutral-interval cents. The highlighted dastgāh scales are skeleton scales ("frets you need to play in this mode"), not a full account of the modal system. All interval cents and modes are editable in js/data.js, and individual frets/wraps are adjustable in the UI.

Testing

  • All JS files pass node --check.
  • Fret math verified in node (octave = L/2 exactly; ET fifth at 219.5 mm on a 660 mm scale; cut lengths and wrap convention sane).
  • Full render path (init → preset switch → dastgāh auto-fret → CSV export) exercised against a DOM shim with no runtime errors.
  • All assets serve 200 over HTTP.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 5 commits June 23, 2026 22:25
Browser tool to convert fretless 4/5-string banjos into Americanized
tar/setar. Self-contained static app (no dependencies, no build step).

Features:
- Instrument parameter form (scale length, neck taper, materials,
  bridge/nut, string count and tuning presets mapping banjo strings to
  Persian roles: sefid/zard/bam/vakhan/zang).
- To-scale SVG fret diagram with koron/sori neutral frets, solfege +
  Western + Persian-script labels, and wrap pips.
- All 12 dastgah/avaz modes with skeleton-scale highlighting and
  optional auto-add of the frets a mode needs.
- Integrated chromatic tuner (Web Audio autocorrelation) with on-neck
  marker and slide-to-tune adjustment hints.
- Per-fret cut & wrap chart for tied Aquila Nylgut (cut length =
  ellipse perimeter x wraps + knot allowance), gauge suggestions,
  CSV export and printable shop sheet.
- Generated, parameter-aware assembly order and tying directions.

Math: generalized rule of 18 for fret positions; Ramanujan ellipse
perimeter for tie lengths. Interval cents and modes editable in
js/data.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHHNhMX5jRXoNRmTtsMnD1
New "Number of metal frets already on the banjo" input enables a hybrid
build: keep the banjo's existing metal frets (exact 12-TET) and only tie
Nylgut frets for the Persian neutral tones (koron/sori) that fall between
them.

- calc.js: existingMetalFrets param; pitches landing on a metal position
  are flagged 'metal' (no tie, no Nylgut) vs 'tie'. Adds metalFretList()
  and coincidesWithMetal(); totalNylgut() now reports tie/metal counts.
- fretboard.js: draws existing metal frets as silver reference bars;
  in-scale metal positions get a marker instead of a tied bar.
- app.js: new input wired through; fret table gains a Type column
  (metal ✓ / tie); summary and CSV updated; assembly guide has a
  dedicated hybrid procedure (metal frets as the reference grid, tie
  only the neutrals between them).
- index.html/styles.css: input, Type column, legend swatch, tag styles.

Fretless mode (0 metal frets) is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHHNhMX5jRXoNRmTtsMnD1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHHNhMX5jRXoNRmTtsMnD1
Units: new top-bar selector switches the whole tool between mm and
inches. All length inputs and output columns convert in place; values
are kept internally in mm. Nylgut gauges stay in mm (how Aquila sells
them). Assembly-guide measurements and the Nylgut total follow the unit.

Fret-removal plan (answers "which frets do I pull to get setar spacing
on an already-fretted banjo"): classifyMetalFrets() tags each existing
metal fret keep (its pitch is in the chosen Persian layout) or remove
(it isn't). A new plan box lists remove/keep/add counts and fret
numbers, and removed frets render as red dashed bars with an ✕ on the
diagram. The octave/tonic (pitch-class do) is always kept. Documents
that neutral koron/sori tones can only be added as ties, never produced
by removal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHHNhMX5jRXoNRmTtsMnD1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHHNhMX5jRXoNRmTtsMnD1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants