Cambios realizados: - server.py: actualiza PROJECT_SAMPLES_DIR a reggaeton - sample_manager.py: cambia base_dir a reggaeton + agrega género reggaeton - health_check.py: actualiza paths a reggaeton - scan_audio.py: actualiza path a reggaeton - segment_rag_builder.py: actualiza default library a reggaeton - reference_stem_builder.py: actualiza PROJECT_SAMPLES_DIR a reggaeton - song_generator.py: agrega GENRE_CONFIG y SECTION_BLUEPRINT para reggaeton - rebuild_index.py: actualiza para apuntar a reggaeton Nueva estructura soportada: - 1. MIDI CHORDS / 2. MIDI ARP (MIDI files) - 3. ONE SHOTS / 4. DRUM LOOPS - 5. FX / 6. IMPACT INTRO / 7. FILL - 8. KICKS / 9. SNARE / 10. PERCS - 11. VOCALS - reggaeton 2/ (bass, drumloops, fx, kick, oneshots, perc, snare) - SentimientoLatino2025/ (drums, vocals, loops, one shots) Index rebuilt: 508 samples
12 KiB
Code Review and Next Steps
Date: 2026-03-29
Repository state reviewed after cleanup commit 5b804db
Scope
This review covers the remaining tracked source in the repository:
AbletonMCP_AI/MCP_Server/*.pyAbletonMCP_AI/MCP_Server/tests/*.py- project docs that define current intent (
CHANGELOG.md,IMPLEMENTATION_REPORT.md,PRO_DJ_ROADMAP.md,tofix.md) - remaining root utility scripts and wrappers (
mcp_wrapper.py,start_mcp.bat,validate_script.py,validate_audio_resampler.py,diagnostico_wsl.py,mcp_1429/server.py, etc.)
Checks executed during the review:
python -m unittest discover .\AbletonMCP_AI\MCP_Server\tests -vpython -m compileall .\AbletonMCP_AI\MCP_Serverpython .\validate_audio_resampler.pypython .\validate_script.pypython .\AbletonMCP_AI\MCP_Server\health_check.py- import smoke for selected modules (
reference_stem_builder,vector_manager,full_integration,server_v2)
Executive summary
The project has a real and useful architecture: server.py is the operational core, song_generator.py and sample_selector.py hold important musical logic, and full_integration.py plus the current tests show that part of the high-level generation pipeline is coherent.
The main problem is not lack of features. The main problem is stability and maintainability drift:
- optional dependencies are treated as hard requirements in several import paths
- machine-specific paths are still embedded across the codebase
server.pycontains duplicated MCP tool definitionssong_generator.pycontains duplicated helper functions- health/validation tooling gives a more optimistic picture than the code currently supports
Before adding more roadmap features, the next sprint should be a stabilization sprint.
Confirmed bugs and risks
P0 - Confirmed functional bugs
-
AbletonMCP_AI/MCP_Server/server_v2.py:393compileallfails withSyntaxError: name '_ableton_connection' is used prior to global declaration.- Current status: the file is in the repo but is not runnable.
- Recommendation: either fix it immediately or archive/remove
server_v2.pyuntil it is valid again.
-
AbletonMCP_AI/MCP_Server/audio_analyzer.py:12numpyis imported at module import-time even whenAudioAnalyzer(backend="basic")is requested.- This breaks
tests/test_sample_selector.py:69and also breaksvalidate_audio_resampler.py. - Evidence:
unittest discover=> 20 tests pass, 1 test errors onModuleNotFoundError: No module named 'numpy'validate_audio_resampler.py=> 0/5 checks pass for the same reason
- Recommendation: move
numpyusage behind lazy import/fallback logic so the "basic" backend really works without scientific deps.
-
AbletonMCP_AI/MCP_Server/requirements.txt- The file only declares
mcp>=1.0.0, but the reviewed code imports or optionally depends on:numpylibrosasoundfilesentence_transformerssklearntorchdemucs
- Current status: environment setup is under-specified.
- Recommendation: split dependencies into base and extras (
audio,ml,stems,dev) and keep docs/tests aligned with those extras.
- The file only declares
P1 - High priority structural defects
-
AbletonMCP_AI/MCP_Server/server.py- Duplicate MCP tool definitions exist.
- AST count during review:
- 93 tool definitions
- 85 unique tool names
- Confirmed duplicate names:
generate_with_human_feelat lines5453and8574apply_clip_fadesat lines5502and8623write_volume_automationat lines5573and8694apply_sidechain_pumpat lines5651and8772inject_pattern_fillsat lines5698and8819humanize_setat lines5746and8867suggest_key_changeat lines5862and6945reset_diversity_memoryat lines6272and8935
- Risk:
- duplicate registration can hide drift between versions
- tool count in docs/changelog may be inflated
- future changes can silently modify only one copy
- Recommendation: dedupe the file and add a test that fails if duplicate tool names exist.
-
AbletonMCP_AI/MCP_Server/song_generator.py- Duplicate helper functions exist:
_get_pattern_variant_penaltyat1582and1939_record_pattern_variant_usageat1586and1946_decay_pattern_variant_memoryat1590and1952reset_pattern_variant_memoryat1594and1960
- Risk:
- shadowed logic
- future edits hitting the wrong copy
- unclear source of truth
- Recommendation: keep one copy, remove the other, and add a regression test for pattern-variant memory behavior.
- Duplicate helper functions exist:
-
AbletonMCP_AI/MCP_Server/health_check.py- Dependency check and test check are misleading:
check_dependencies()hard-requiresnumpy,sklearn,sentence_transformersat lines75-83check_tests()only runstests.test_human_feelat lines135-147- the report can say
"All tests passing"even while the full suite fails
- Actual observed behavior:
health_check.pyreported 5/9 checks passing- unit tests were marked as passing
- the full suite still fails on
audio_analyzer.py
- Recommendation:
- split "core deps" vs "optional deps"
- run the real suite, not a single test module
- expose failed check details in console output more clearly
- Dependency check and test check are misleading:
-
AbletonMCP_AI/MCP_Server/reference_stem_builder.py:13-16- Heavy dependencies are imported at module import-time:
soundfiletorchdemucs
- Import smoke result:
reference_stem_builderfails immediately withModuleNotFoundError: No module named 'soundfile'
- Recommendation:
- move these imports inside the stem-building flow
- gate the feature behind a clear optional dependency check
- document the extra dependency group
- Heavy dependencies are imported at module import-time:
P2 - Portability and packaging issues
-
Hard-coded local paths remain in operational files and demos:
AbletonMCP_AI/MCP_Server/server.pyAbletonMCP_AI/MCP_Server/server_v2.py:53AbletonMCP_AI/MCP_Server/start_server.py:6-10mcp_wrapper.py:10start_mcp.bat:2-4AbletonMCP_AI/MCP_Server/scan_audio.py:5AbletonMCP_AI/MCP_Server/sample_system_demo.py:25,52AbletonMCP_AI/MCP_Server/reference_stem_builder.pyand other modules still assume local library layout- Risk:
- fragile on another machine
- hard to test in CI
- requires
sys.pathhacks and wrapper scripts
- Recommendation:
- introduce a
settings.pyor env-driven config layer - use package-relative imports
- stop hardcoding
C:\Users\ren\...andC:\ProgramData\...in runtime modules
- introduce a
-
Package import strategy is still brittle
- Evidence:
server.pymutatessys.pathserver_v2.pymutatessys.pathstart_server.pyforcesos.chdir(...)- tests also mutate
sys.path
- Risk:
- behavior depends on launch location
- tools may work from one wrapper and fail from another
- Recommendation:
- make
AbletonMCP_AIa real package boundary - prefer
from .module import ...orfrom AbletonMCP_AI.MCP_Server.module import ... - keep wrapper scripts thin and path-agnostic
- make
- Evidence:
-
Validation/diagnostic scripts are not resilient
validate_script.pycrashes on connection refusal instead of reporting a clean diagnostic result.validate_audio_resampler.pyassumes import-time availability of the whole scientific stack.mcp_1429/server.pylooks like an unrelated test server and should not live near production entrypoints.- Recommendation:
- move one-off utilities into
scripts/dev,scripts/diagnostics, andscripts/manual - make each script report actionable failure instead of throwing raw tracebacks
- move one-off utilities into
Code review notes by area
What is good
full_integration.pyis coherent and readable for a high-level orchestration layer.sample_selector.pyhas real domain logic for fatigue, palette, coverage and compatibility.audio_key_compatibility.py,audio_arrangement.py,audio_mastering.py, andhuman_feel.pyare good candidates for stable domain modules.- There is already some test coverage around:
- human feel
- full integration
- sample selector behavior
- The roadmap and implementation report are detailed enough to guide future work.
What is weak
server.pyis now a monolith at ~10k lines.song_generator.pyis ~6k lines and mixes configuration, generation logic, transition logic, and pattern-memory helpers.reference_listener.pyis ~4.7k lines and likely deserves its own decomposition plan.- project scripts are still spread between core runtime, demos, wrappers, manual validators and environment-specific helpers.
- docs are drifting from reality:
tofix.mdsays there are no critical runtime issues- current code still has confirmed critical issues
Priority roadmap for the next implementation sprint
Sprint 1 - Stabilize the runtime
- Fix
audio_analyzer.pysobackend="basic"works withoutnumpy. - Decide the fate of
server_v2.py: fix or archive. - Deduplicate
server.pyMCP tools. - Deduplicate
song_generator.pypattern-memory helpers. - Make
health_check.pyhonest:- real suite
- real dependency tiers
- clearer reporting
- Update
requirements.txtinto real install profiles.
Sprint 2 - Make the code portable
- Create a centralized config layer for:
- sample library paths
- ProgramData paths
- host/port values
- optional feature flags
- Remove machine-specific paths from wrappers and demos.
- Replace
sys.path/os.chdirhacks with package-safe imports.
Sprint 3 - Reduce maintenance cost
- Split
server.pyinto smaller modules, for example:tools_session.pytools_generation.pytools_validation.pytools_audio_fx.pytools_learning.py
- Move manual scripts and demos into
scripts/:scan_audio.pysample_system_demo.pyvalidate_script.pyvalidate_audio_resampler.pydiagnostico_wsl.pytemp_socket_cmd.pyplace_perc_audio.pyset_input_routing.pymcp_1429/server.py
Sprint 4 - Improve confidence
- Add CI for:
- import smoke
compileall- full unit test suite
- duplicate-tool-name detection
- Add tests for:
audio_analyzerbasic fallbackhealth_checkcorrectness- server tool registration uniqueness
- config/path resolution without local machine assumptions
Feature work that should wait until after stabilization
The docs already show partially implemented roadmap items. These should be resumed only after the runtime is stable:
- T017 / T019: brighter and key-aware sample analysis quality
- T044 / T047: dynamic variation and loop variation completion
- T051 / T058 / T059: better tonal and spectral section behavior
- T068 / T069 / T070: section-based kick, hat and bass evolution
- T089: A/B drop testing
- T101 / T103 / T105: real regression coverage, hot reload strategy, CI
Suggested owner checklist for the next pass
- Fix dependency model first
- Remove duplicate definitions in
server.py - Remove duplicate helpers in
song_generator.py - Make health check trustworthy
- Move environment-specific utilities out of the core
- Add CI so the same regressions do not come back
Bottom line
The project is not blocked by lack of ideas. It is blocked by runtime honesty and codebase shape.
If the next work session focuses on stabilization, packaging and test truthfulness, the feature roadmap becomes much safer to continue. If new features are added first, the duplicate logic and environment coupling will keep compounding.