note sets for strings

This commit is contained in:
2025-12-26 18:42:41 +01:00
parent b8e8623024
commit bd18844c73
2 changed files with 30 additions and 3 deletions

View File

@@ -99,6 +99,21 @@ function App() {
return []; 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 // Static fallback
if (config.notes) return config.notes; if (config.notes) return config.notes;
if (config.min !== undefined && config.max !== undefined) { if (config.min !== undefined && config.max !== undefined) {

View File

@@ -2,7 +2,7 @@ import type { Instrument } from './Tunings';
export type ClefMode = 'treble' | 'bass' | 'grand'; 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 { export interface NoteSetConfig {
id: string; id: string;
@@ -13,6 +13,7 @@ export interface NoteSetConfig {
notes?: number[]; // Explicit list for static notes?: number[]; // Explicit list for static
defaultMinFret?: number; defaultMinFret?: number;
defaultMaxFret?: number; defaultMaxFret?: number;
stringIndex?: number; // 0-based index from lowest string (0) to highest
} }
export interface InstrumentDefinition { export interface InstrumentDefinition {
@@ -57,7 +58,14 @@ export const INSTRUMENT_DEFINITIONS: Record<string, InstrumentDefinition> = {
type: 'custom_fret', type: 'custom_fret',
defaultMinFret: 0, defaultMinFret: 0,
defaultMaxFret: 12 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: { bass: {
@@ -68,7 +76,11 @@ export const INSTRUMENT_DEFINITIONS: Record<string, InstrumentDefinition> = {
showTuning: true, showTuning: true,
ranges: [ ranges: [
// Bass Standard: E1 (28) -> G3 approx (55) // 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: { piano: {