From 6a590af0267a6e2ae604a154884e5deb49cb9a00 Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Sun, 7 Jun 2026 23:02:47 +0200 Subject: [PATCH] treble bleed enhancements --- .../diylc/netlist/GuitarDiagramAnalyzer.java | 20 +------ .../java/org/diylc/netlist/TrebleBleed.java | 55 ++++++++++++++----- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/diylc/diylc-library/src/main/java/org/diylc/netlist/GuitarDiagramAnalyzer.java b/diylc/diylc-library/src/main/java/org/diylc/netlist/GuitarDiagramAnalyzer.java index c8cff77d..371930fb 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/netlist/GuitarDiagramAnalyzer.java +++ b/diylc/diylc-library/src/main/java/org/diylc/netlist/GuitarDiagramAnalyzer.java @@ -369,26 +369,12 @@ public class GuitarDiagramAnalyzer extends AbstractNetlistAnalyzer implements IN notes.add(sb.toString()); TrebleBleed trebleBleed = volPotTrebleBleedMap.get(e.getKey()); - Set> trebleBleedComponents = trebleBleed.components(); - if (trebleBleedComponents != null && !trebleBleedComponents.isEmpty()) { - - TrebleBleed.AnalysisResult analyze = trebleBleed.analyze(); - - String strComponents = - trebleBleedComponents.stream().sorted(Comparator.comparing(IDIYComponent::getName)) - .map(c -> "'" + c.getName() + "'").collect(Collectors.joining(", ")); - String trebleBleedNote = strComponents + (trebleBleedComponents.size() == 1 ? " forms a " : " form a "); - if (analyze.circuitType() != null) { - trebleBleedNote += analyze.circuitType() + " "; - } - trebleBleedNote = trebleBleedNote + "treble bleed circuit on the '" + e.getKey().getName() + "' volume control"; - if (analyze.style() != null) { - trebleBleedNote = trebleBleedNote + ", in the style of " + analyze.style(); - } + String trebleBleedNote = trebleBleed.toNote(e.getKey()); + if (trebleBleedNote != null && !trebleBleedNote.isEmpty()) { notes.add(trebleBleedNote); } } - + private void processPotentiometer(IDIYComponent pot, Tree tree, Map, Tree> pickupRoots, Map, List>> tonePotPickupReverseMap, Map, List>> tonePotPickupMap, diff --git a/diylc/diylc-library/src/main/java/org/diylc/netlist/TrebleBleed.java b/diylc/diylc-library/src/main/java/org/diylc/netlist/TrebleBleed.java index 7fbffa17..a68428ee 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/netlist/TrebleBleed.java +++ b/diylc/diylc-library/src/main/java/org/diylc/netlist/TrebleBleed.java @@ -3,12 +3,38 @@ package org.diylc.netlist; import org.diylc.core.IDIYComponent; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; public record TrebleBleed(Set> components, TreeConnectionType connectionType) { - public AnalysisResult analyze() { + public String toNote(IDIYComponent volumePotComponent) { + Set> trebleBleedComponents = components(); + if (trebleBleedComponents != null && !trebleBleedComponents.isEmpty()) { + + TrebleBleed.AnalysisResult analyze = analyze(); + + String strComponents = + trebleBleedComponents.stream().sorted(Comparator.comparing(IDIYComponent::getName)) + .map(c -> "'" + c.getName() + "'").collect(Collectors.joining(", ")); + String trebleBleedNote = + strComponents + (trebleBleedComponents.size() == 1 ? " forms a " : " form a "); + if (analyze.circuitType() != null) { + trebleBleedNote += analyze.circuitType() + " "; + } + trebleBleedNote = trebleBleedNote + "treble bleed circuit on the '" + volumePotComponent + .getName() + "' volume control"; + if (analyze.style() != null) { + trebleBleedNote = trebleBleedNote + ", in the style of " + analyze.style(); + } + return trebleBleedNote; + } + return null; + } + + private AnalysisResult analyze() { List capValues = new ArrayList<>(); List resValues = new ArrayList<>(); for (IDIYComponent c : components) { @@ -25,28 +51,34 @@ public record TrebleBleed(Set> components, TreeConnectionType c String style; if (components.size() == 1) { circuitType = null; - style = "PRS, G&L"; + style = "PRS, G&L, Ibanez, Ernie Ball Music Man (values not matching exactly)"; if (capValues.size() == 1) { Double cVal = capValues.get(0); if (matches(cVal, 180e-6)) { style = "PRS"; } else if (matches(cVal, 200e-6)) { style = "G&L"; + } else if (matches(cVal, 330e-6)) { + style = "Ibanez, Ernie Ball Music Man"; } } } else if (components.size() == 2 && connectionType == TreeConnectionType.Series) { circuitType = "series"; - style = "Kinman"; + style = "Kinman, Fender Tone Saver (values not matching exactly)"; if (capValues.size() == 1 && resValues.size() == 1) { Double cVal = capValues.get(0); Double rVal = resValues.get(0); if (matches(cVal, 1.2e-3) && matches(rVal, 130e3)) { style = "Kinman"; + } else if (matches(cVal, 1e-3) && matches(rVal, 130e3)) { + style = "Fender Tone Saver (250K)"; + } else if (matches(cVal, 500e-6) && matches(rVal, 240e3)) { + style = "Fender Tone Saver (500K)"; } } } else if (components.size() == 2 && connectionType == TreeConnectionType.Parallel) { circuitType = "parallel"; - style = "Fender, Suhr, Fralin, Bill Lawrence, Mojo Tone, TV Jones, DiMarzio, Seymour Duncan"; + style = "Fender, Suhr, Fralin, Bill Lawrence, Mojo Tone, TV Jones, DiMarzio, Seymour Duncan, Bare Knuckle Pickups, Emerson Custom (values not matching exactly)"; if (capValues.size() == 1 && resValues.size() == 1) { Double cVal = capValues.get(0); Double rVal = resValues.get(0); @@ -54,10 +86,14 @@ public record TrebleBleed(Set> components, TreeConnectionType c style = "Bill Lawrence"; } else if (matches(cVal, 471e-6) && matches(rVal, 220e3)) { style = "Mojo Tone"; + } else if (matches(cVal, 470e-6) && matches(rVal, 220e3)) { + style = "Emerson Custom"; } else if (matches(cVal, 560e-6) && matches(rVal, 300e3)) { style = "DiMarzio"; } else if (matches(cVal, 680e-6) && matches(rVal, 150e3)) { style = "John Suhr"; + } else if ((matches(cVal, 680e-6) || matches(cVal, 1e-3)) && matches(rVal, 220e3)) { + style = "Bare Knuckle Pickups"; } else if ((matches(cVal, 1e-3) || matches(cVal, 2e-3)) && matches(rVal, 150e3)) { style = "TV Jones"; } else if (matches(cVal, 1e-3) && matches(rVal, 100e3)) { @@ -66,15 +102,6 @@ public record TrebleBleed(Set> components, TreeConnectionType c style = "Lindy Fralin"; } } - } else if (components.size() == 3) { - circuitType = null; - style = null; - if (capValues.size() == 1 && resValues.size() == 2) { - Double cVal = capValues.get(0); - if (matches(cVal, 1.2e-3) && ((matches(resValues.get(0), 150e3) && matches(resValues.get(1), 20e3)) || (matches(resValues.get(0), 20e3) && matches(resValues.get(1), 150e3)))) { - style = "Fender"; - } - } } else { circuitType = null; style = null; @@ -87,5 +114,5 @@ public record TrebleBleed(Set> components, TreeConnectionType c return val != null && Math.abs(val - expected) < expected * 1e-4; } - public record AnalysisResult(String circuitType, String style) {} + private record AnalysisResult(String circuitType, String style) {} }