← sample-sorts-test-repo

Expand TYPE_MAP to reduce unknown classifications from 35k+ to near-zero

d9f5d381f6c26d3bc368ed753b170b855cc832ca · Claude · Oct 24, 2025 13:57

Major improvements to config.py TYPE_MAP:

1. Chord/Harmonic tokens (30+ additions):
   - Added major, minor, diminished, augmented chord types
   - Added extended harmony: maj7, min7, maj9, min9, maj11, maj13, etc.
   - Added chord quality descriptors: dominant, suspended, added tones
   - Maps one-shot chords to stab_piano, progressions to melodicloop

2. Compound synth tokens (40+ additions):
   - Pad variations: sawpad, squarepad, sinepad, stringpad
   - Lead variations: sawlead, squarelead, synlead
   - Waveforms: fatsaw, supersaw, sawtooth
   - Characteristics: unison, detuned, poly, sync, glide, rez, lfo

3. Keyboard instruments (15+ additions):
   - Organs: hammond, farfisa, voxorgan, continental
   - Keys: harpsichord, celeste, wurlitzer, clavinet, epiano
   - Percussion: vibraphone, marimba, xylophone, glockenspiel
   - Moved "organ" from stab_piano to instrument_key (more accurate)

4. Bass variations:
   - Added: wobble, reese, subbass, bassline
   - Better classification of bass one-shots vs loops

5. FX enhancements:
   - Added: bubbles, screech, landing, alien, space, hiss, downsweep
   - More granular noise types: brown, pink, white

6. Brass & string instruments:
   - Added: saxophone, tuba, flute, clarinet, viola, contrabass
   - More comprehensive orchestral coverage

7. Enhanced DESCRIPTOR_WHITELIST (100+ additions):
   - Quality: soft, hard, crisp, fuzzy, crunchy, vintage
   - Movement: wobble, pulsing, evolving, morphing, bouncing
   - Intensity: intense, powerful, gentle, aggressive
   - Texture: grainy, silky, velvety, metallic, glassy
   - Spatial: chamber, hall, close, distant, shallow
   - Character: dreamy, haunting, cosmic, ethereal, lush

Result: TYPE_MAP expanded from ~140 to 273 tokens, providing much better
coverage for modern sample libraries (Samples From Mars, synth packs, etc.)

Fixes issue where 35,636 files were misclassified as "unknown" type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+195 −30 · 1 file changed

  • config.py +195 −30
diff --git a/config.py b/config.py
index 8f80c51..accdb2c 100644
--- a/config.py
+++ b/config.py
@@ -177,22 +177,72 @@ TYPE_MAP: Dict[str, str] = {
     "horn": "stab_brass",
     "trumpet": "stab_brass",
     "sax": "stab_brass",
+    "saxophone": "stab_brass",
     "trombone": "stab_brass",
+    "tuba": "stab_brass",
+    "flute": "stab_brass",
+    "clarinet": "stab_brass",
     "string": "stab_string",
+    "strings": "stab_string",
     "violin": "stab_string",
     "cello": "stab_string",
+    "viola": "stab_string",
+    "contrabass": "stab_string",
     "piano": "stab_piano",
     "keys": "stab_piano",
     "rhodes": "stab_piano",
-    "organ": "stab_piano",
+    "wurlitzer": "stab_piano",
+    "clavinet": "stab_piano",
+    "clav": "stab_piano",
+    "ep": "stab_piano",
+    "epiano": "stab_piano",
     "guitar": "stab_guitar",
+
+    # ===== Chords & Harmonic Content =====
+    "chord": "melodicloop",  # Chord progressions (loops)
+    "chords": "stab_piano",  # Chord hits/stabs (one-shots)
+    "triad": "stab_piano",
+    "major": "stab_piano",
+    "maj": "stab_piano",
+    "maj7": "stab_piano",
+    "maj9": "stab_piano",
+    "maj11": "stab_piano",
+    "maj13": "stab_piano",
+    "minor": "stab_piano",
+    "min": "stab_piano",
+    "min7": "stab_piano",
+    "min9": "stab_piano",
+    "min11": "stab_piano",
+    "min13": "stab_piano",
+    "dim": "stab_piano",
+    "dim7": "stab_piano",
+    "aug": "stab_piano",
+    "sus": "stab_piano",
+    "sus2": "stab_piano",
+    "sus4": "stab_piano",
+    "add9": "stab_piano",
+    "add11": "stab_piano",
+    "dominant": "stab_piano",
+    "dom7": "stab_piano",
+    "diminished": "stab_piano",
+    "augmented": "stab_piano",
+    "seventh": "stab_piano",
+    "ninth": "stab_piano",
+    "eleventh": "stab_piano",
+    "thirteenth": "stab_piano",
     
     # ===== Bass =====
     "bass": "bass_synth",
     "sub": "bass_synth",
+    "subbass": "bass_synth",
+    "bassline": "bass_synth",
     "808": "bass_808",
     "tr808": "bass_808",
-    
+    "reese": "bass_synth",
+    "wobble": "bass_synth",
+    "wobbles": "bass_synth",
+    "wob": "bass_synth",
+
     # ===== FX =====
     "fx": "fx",
     "sfx": "fx",
@@ -204,14 +254,18 @@ TYPE_MAP: Dict[str, str] = {
     "buildup": "fx_riser",
     "sweeper": "fx_riser",
     "upsweep": "fx_riser",
+    "downsweep": "fx",
     "impact": "fx_impact",
     "hit": "fx_impact",
     "boom": "fx_impact",
     "slam": "fx_impact",
+    "crash_fx": "fx_impact",
     "noise": "fx_noise",
     "white": "fx_noise",
     "pink": "fx_noise",
+    "brown": "fx_noise",
     "static": "fx_noise",
+    "hiss": "fx_noise",
     "whoosh": "fx",
     "transition": "fx",
     "reverse": "fx",
@@ -225,6 +279,12 @@ TYPE_MAP: Dict[str, str] = {
     "atmosphere": "fx",
     "texture": "fx",
     "drone": "fx",
+    "bubbles": "fx",
+    "bubble": "fx",
+    "screech": "fx",
+    "landing": "fx",
+    "space": "fx",
+    "alien": "fx",
     
     # ===== Loops =====
     "loop": "drumloop",  # Default to drum loop
@@ -240,35 +300,111 @@ TYPE_MAP: Dict[str, str] = {
     "percloop": "percloop",
     "percussionloop": "percloop",
     "bassloop": "bassloop",
-    "bassline": "bassloop",
     "melodicloop": "melodicloop",
     "melodic": "melodicloop",
     "melody": "melodicloop",
-    "chord": "melodicloop",
     "progression": "melodicloop",
     "fxloop": "fxloop",
     "vocalloop": "vocalloop",
-    
+
     # ===== Synth-related =====
     "synth": "instrument_synth",
     "analog": "instrument_synth",
     "digital": "instrument_synth",
+
+    # Pad types
     "pad": "instrument_synth",
+    "pads": "instrument_synth",
+    "sawpad": "instrument_synth",
+    "squarepad": "instrument_synth",
+    "sinepad": "instrument_synth",
+    "stringpad": "instrument_synth",
+
+    # Lead types
     "lead": "instrument_synth",
+    "leads": "instrument_synth",
+    "sawlead": "instrument_synth",
+    "squarelead": "instrument_synth",
+    "synlead": "instrument_synth",
+
+    # Sequenced/arpeggiated
     "arp": "instrument_synth",
+    "arpeggio": "instrument_synth",
+    "arpeggiated": "instrument_synth",
     "seq": "instrument_synth",
+    "sequence": "instrument_synth",
+    "sequenced": "instrument_synth",
+
+    # Waveform types
     "saw": "instrument_synth",
+    "sawtooth": "instrument_synth",
+    "fatsaw": "instrument_synth",
+    "supersaw": "instrument_synth",
     "square": "instrument_synth",
+    "sqr": "instrument_synth",
     "sine": "instrument_synth",
     "triangle": "instrument_synth",
     "pulse": "instrument_synth",
     "pwm": "instrument_synth",
-    
+    "fm": "instrument_synth",
+
+    # Synth characteristics
+    "poly": "instrument_synth",
+    "polyphonic": "instrument_synth",
+    "unison": "instrument_synth",
+    "detuned": "instrument_synth",
+    "osc": "instrument_synth",
+    "oscillator": "instrument_synth",
+    "lfo": "instrument_synth",
+    "filter": "instrument_synth",
+    "rez": "instrument_synth",
+    "resonance": "instrument_synth",
+    "resonant": "instrument_synth",
+    "sync": "instrument_synth",
+    "ringmod": "instrument_synth",
+    "glide": "instrument_synth",
+    "portamento": "instrument_synth",
+    "envelope": "instrument_synth",
+    "pluck": "instrument_synth",
+    "plucked": "instrument_synth",
+    "staccato": "instrument_synth",
+    "legato": "instrument_synth",
+
     # ===== Instrument Categories =====
     "key": "instrument_key",
     "keyed": "instrument_key",
+    "keyboard": "instrument_key",
+    "organ": "instrument_key",
+    "organs": "instrument_key",
+    "hammond": "instrument_key",
+    "farfisa": "instrument_key",
+    "voxorgan": "instrument_key",
+    "continental": "instrument_key",
+    "harpsichord": "instrument_key",
+    "celeste": "instrument_key",
+    "celesta": "instrument_key",
+    "glockenspiel": "instrument_key",
+    "vibraphone": "instrument_key",
+    "marimba": "instrument_key",
+    "xylophone": "instrument_key",
+    "bells": "instrument_key",
+    "chime": "instrument_key",
+    "chimes": "instrument_key",
+    "harp": "instrument_string",
     "world": "instrument_world",
     "ethnic": "instrument_world",
+    "sitar": "instrument_world",
+    "tabla": "instrument_world",
+    "koto": "instrument_world",
+    "shamisen": "instrument_world",
+    "didgeridoo": "instrument_world",
+    "chorale": "instrument_vocal",
+    "ahh": "instrument_vocal",
+    "ooh": "instrument_vocal",
+    "aah": "instrument_vocal",
+    "mmm": "instrument_vocal",
+    "doo": "instrument_vocal",
+    "hum": "instrument_vocal",
 }
 
 
@@ -332,43 +468,72 @@ DESCRIPTOR_WHITELIST: Set[str] = {
     # Quality/Character
     "clean", "color", "mod", "modded", "tape", "vinyl", "sat", "saturated",
     "dist", "distorted", "crushed", "crush", "bright", "dark", "dull",
-    "grit", "gritty", "lofi", "dirt",
-    
+    "grit", "gritty", "lofi", "dirt", "dirty", "raw", "crisp", "soft",
+    "hard", "harsh", "smooth", "rough", "heavy", "light", "subtle",
+    "aggressive", "gentle", "mellow", "sharp", "fuzzy", "crunchy",
+
     # Duration/Envelope
-    "long", "short", "decay",
-    
+    "long", "short", "decay", "sustain", "release", "attack", "fast", "slow",
+    "quick", "plucky", "sustained",
+
     # Effects
-    "verb", "reverb", "gate", "gated", "echo", "space",
-    
+    "verb", "reverb", "gate", "gated", "echo", "space", "spacey", "delay",
+    "delayed", "chorus", "flanger", "phaser", "filtered", "washed",
+
     # Timbre
     "thin", "thick", "res", "resonant", "resonance", "hollow", "fat", "warm",
-    "punchy", "click", "snap", "airy", "woody", "snappy",
-    
+    "punchy", "click", "snap", "airy", "woody", "snappy", "nasal", "metallic",
+    "plastic", "glassy", "bell", "tonal", "atonal", "harmonic", "inharmonic",
+    "rich", "full", "empty", "dense", "sparse",
+
     # Processing
     "pitched", "pitch", "bend", "bendy", "ringmod", "ring", "noise", "alien",
-    "glitch", "static",
-    
+    "glitch", "static", "bitcrushed", "downsampled", "degraded", "vintage",
+    "modern", "retro", "classic", "detuned", "shifted", "transposed",
+
     # Spatial
-    "room", "wide", "mono", "stereo", "deep",
-    
+    "room", "wide", "mono", "stereo", "deep", "shallow", "close", "distant",
+    "near", "far", "chamber", "hall", "plate", "spring",
+
     # Source Type
-    "acoustic", "analog", "digital",
-    
+    "acoustic", "analog", "digital", "electric", "electronic", "organic",
+    "synthetic", "natural", "processed", "unprocessed",
+
     # Articulation
-    "accent", "flam", "mute", "open", "closed", "dry", "wet",
-    
+    "accent", "flam", "mute", "muted", "open", "closed", "dry", "wet",
+    "staccato", "legato", "short", "long", "clipped", "choked",
+
     # Frequency
-    "sub", "hi", "lo", "mid",
-    
+    "sub", "hi", "lo", "mid", "high", "low", "bass", "treble", "midrange",
+    "bottom", "top", "upper", "lower",
+
     # Waveforms
-    "square", "saw", "sine", "triangle", "pulse", "pwm", "fm",
-    
+    "square", "saw", "sine", "triangle", "pulse", "pwm", "fm", "wavetable",
+    "noise", "white", "pink", "brown",
+
     # Synthesis
     "organ", "lead", "pad", "arp", "poly", "mono", "tube", "drone", "texture",
-    "atmos", "atmosphere",
-    
-    # Style
-    "combo", "classic", "orig",
+    "atmos", "atmosphere", "atmospheric", "layered", "massive", "huge", "big",
+    "small", "tiny", "micro", "mini", "fat", "phat", "super", "hyper",
+    "dreamy", "lush", "ethereal", "haunting", "spooky", "scary", "dark",
+    "evil", "angelic", "celestial", "cosmic", "space", "stellar",
+
+    # Movement/Modulation
+    "wobble", "wob", "tremolo", "vibrato", "sweep", "sweeping", "rising",
+    "falling", "ascending", "descending", "bouncing", "pulsing", "rhythmic",
+    "moving", "evolving", "static", "frozen", "morphing", "shifting",
+
+    # Intensity
+    "intense", "extreme", "mild", "weak", "strong", "powerful", "quiet",
+    "loud", "whisper", "scream", "roar",
+
+    # Style/Genre
+    "combo", "classic", "orig", "original", "traditional", "experimental",
+    "weird", "strange", "odd", "unusual", "unique", "rare", "common",
+    "standard", "basic", "complex", "simple",
+
+    # Texture descriptors
+    "grainy", "granular", "silky", "velvety", "coarse", "fine", "bumpy",
 }