From bd18844c73aca6f7e8602ec7c1a45857e2d673c8 Mon Sep 17 00:00:00 2001 From: Jens Mohrmann Date: Fri, 26 Dec 2025 18:42:41 +0100 Subject: [PATCH] note sets for strings --- src/App.tsx | 15 +++++++++++++++ src/music/InstrumentConfigs.ts | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 41cc6e0..8561b5e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -99,6 +99,21 @@ function App() { return []; } + if (config.type === 'specific_string') { + if (currentTuning && config.stringIndex !== undefined) { + const openNote = currentTuning.strings[config.stringIndex]; + if (openNote === undefined) return []; + + // Generate frets 0 to 12 for this string + const notes = []; + for (let i = 0; i <= 12; i++) { + notes.push(openNote + i); + } + return notes; + } + return []; + } + // Static fallback if (config.notes) return config.notes; if (config.min !== undefined && config.max !== undefined) { diff --git a/src/music/InstrumentConfigs.ts b/src/music/InstrumentConfigs.ts index 2ac7eda..4ee31c7 100644 --- a/src/music/InstrumentConfigs.ts +++ b/src/music/InstrumentConfigs.ts @@ -2,7 +2,7 @@ import type { Instrument } from './Tunings'; export type ClefMode = 'treble' | 'bass' | 'grand'; -export type NoteSetType = 'static' | 'open_strings' | 'first_position' | 'custom_fret'; +export type NoteSetType = 'static' | 'open_strings' | 'first_position' | 'custom_fret' | 'specific_string'; export interface NoteSetConfig { id: string; @@ -13,6 +13,7 @@ export interface NoteSetConfig { notes?: number[]; // Explicit list for static defaultMinFret?: number; defaultMaxFret?: number; + stringIndex?: number; // 0-based index from lowest string (0) to highest } export interface InstrumentDefinition { @@ -57,7 +58,14 @@ export const INSTRUMENT_DEFINITIONS: Record = { type: 'custom_fret', defaultMinFret: 0, defaultMaxFret: 12 - } + }, + // Per String Sets (High E is index 5, Low E is index 0) + { id: 'string_1', label: 'String 1 (High)', type: 'specific_string', stringIndex: 5 }, + { id: 'string_2', label: 'String 2', type: 'specific_string', stringIndex: 4 }, + { id: 'string_3', label: 'String 3', type: 'specific_string', stringIndex: 3 }, + { id: 'string_4', label: 'String 4', type: 'specific_string', stringIndex: 2 }, + { id: 'string_5', label: 'String 5', type: 'specific_string', stringIndex: 1 }, + { id: 'string_6', label: 'String 6 (Low)', type: 'specific_string', stringIndex: 0 }, ] }, bass: { @@ -68,7 +76,11 @@ export const INSTRUMENT_DEFINITIONS: Record = { showTuning: true, ranges: [ // Bass Standard: E1 (28) -> G3 approx (55) - { id: 'all', label: 'All Notes', type: 'static', min: 28, max: 55 } + { id: 'all', label: 'All Notes', type: 'static', min: 28, max: 55 }, + { id: 'string_1', label: 'String 1 (High)', type: 'specific_string', stringIndex: 3 }, + { id: 'string_2', label: 'String 2', type: 'specific_string', stringIndex: 2 }, + { id: 'string_3', label: 'String 3', type: 'specific_string', stringIndex: 1 }, + { id: 'string_4', label: 'String 4 (Low)', type: 'specific_string', stringIndex: 0 }, ] }, piano: {