jdxi_editor.ui.editors.synth.specs
Attributes
Classes
Canonical description of a JD-Xi instrument preset. |
|
Icon filenames that may carry an engine's artwork. |
Functions
|
Normalize preset labels for keyword matching. |
|
Expand an engine or instrument name into the image basenames to try. |
|
|
|
Normalized forms of a preset label to match keywords against. |
|
Test whether keyword occurs in any of the normalized texts. |
|
Test whether any of keywords occurs in texts. |
|
Candidate image basenames named after the preset itself. |
Module Contents
- class jdxi_editor.ui.editors.synth.specs.InstrumentDescriptor[source]
Canonical description of a JD-Xi instrument preset.
- jdxi_editor.ui.editors.synth.specs.preset_match_text(text: str) str[source]
Normalize preset labels for keyword matching.
Strips a leading program index (e.g.
001 - Power 3→power 3,101: MKS-50 Bass1→mks-50 bass1). The index has to go, otherwise it is matched as a model number:101would detect an SH-101 and202an MC-202.
- jdxi_editor.ui.editors.synth.specs.ENGINE_KEYWORDS: list[EngineKeywordSpec][source]
- class jdxi_editor.ui.editors.synth.specs.EngineImageSpec[source]
Icon filenames that may carry an engine’s artwork.
Note that
basenamesholds filenames, not keywords: keywords decide which engine a preset belongs to (seeEngineKeywordSpec), while these decide which file is drawn for it.
- jdxi_editor.ui.editors.synth.specs.ENGINE_IMAGE_SPECS: list[EngineImageSpec][source]
- jdxi_editor.ui.editors.synth.specs.engine_image_basenames(name: str) tuple[str, ...][source]
Expand an engine or instrument name into the image basenames to try.
- Parameters:
name – Detected engine or instrument name (e.g.
"tb").- Returns:
Candidate basenames without extension, most specific first.
- jdxi_editor.ui.editors.synth.specs._short_keyword_pattern(keyword: str) re.Pattern[source]
- jdxi_editor.ui.editors.synth.specs.preset_match_texts(text: str) tuple[str, ...][source]
Normalized forms of a preset label to match keywords against.
The JD-Xi runs tone names together to fit its display, and the two forms pull in opposite directions:
"S-SawStacLd1"needs the glued form for the keywordsawstac, while"ResoPulseBs1"needs the split form for the keywordbs. Both are returned, so a keyword matching either counts.- Parameters:
text – Preset label, with or without its index.
- Returns:
The normalized label, plus its camel-case-split form when that differs.
- jdxi_editor.ui.editors.synth.specs.keyword_in(texts, keyword: str) bool[source]
Test whether keyword occurs in any of the normalized texts.
Keywords longer than
SHORT_KEYWORD_LENGTHmatch as substrings; shorter ones have to sit on a letter boundary.- Parameters:
texts – Normalized preset text, or several forms of it (see
preset_match_texts()).keyword – Keyword to look for, lower case.
- Returns:
True when the keyword matches.
- jdxi_editor.ui.editors.synth.specs.any_keyword_in(texts, keywords: Iterable[str]) bool[source]
Test whether any of keywords occurs in texts.
- Parameters:
texts – Normalized preset text, or several forms of it.
keywords – Keywords to look for.
- Returns:
True when at least one keyword matches.
- jdxi_editor.ui.editors.synth.specs.preset_image_basenames(text: str) tuple[str, ...][source]
Candidate image basenames named after the preset itself.
The preset label, minus its index and trailing variant number, is offered in the spellings artwork tends to use:
"164: Trem EP 1"looks fortrem ep,trem-ep,trem_ep(and the same without punctuation). Dropping a file named after a preset into the icon folder is therefore enough to give that preset its own image – no table to update here.Only multi-word phrases are returned. A single word is far too broad to be preset-specific (“bass”, “lead”), and the name and family lookups already cover that case.
- Parameters:
text – Preset label, with or without its index.
- Returns:
Candidate basenames without extension, most specific first.