Initial commit: AbletonMCP-AI complete system
- MCP Server with audio fallback, sample management - Song generator with bus routing - Reference listener and audio resampler - Vector-based sample search - Master chain with limiter and calibration - Fix: Audio fallback now works without M4L - Fix: Full song detection in sample loader Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
104
AbletonMCP_AI_BAK_20260328_200801/MCP_Server/agent7_vocals.py
Normal file
104
AbletonMCP_AI_BAK_20260328_200801/MCP_Server/agent7_vocals.py
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Agent 7 - VOCAL/CHOIR SPECIALIST
|
||||
Loads vocal samples at specific arrangement positions
|
||||
"""
|
||||
import socket
|
||||
import json
|
||||
import sys
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PORT = 9877
|
||||
|
||||
VOCAL_MAIN_TRACK = 12
|
||||
VOCAL_TEXTURE_TRACK = 13
|
||||
|
||||
VOCAL_MAIN_SAMPLES = [
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\loops\vocal\BBH- Primer Impacto - Vocal Quema D#m 126 Bpm.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\oneshots\vocal\BBH - Primer Impacto - Vocal Importante 1.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\oneshots\vocal\BBH - Primer Impacto - Vocal Importante 2.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\oneshots\vocal\BBH - Primer Impacto - Vocal Importante 3.wav",
|
||||
]
|
||||
|
||||
VOCAL_TEXTURE_SAMPLES = [
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\loops\vocal\Vox_03_Am_125.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\loops\vocal\Vox_05_Cm_125.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\loops\vocal\Vox_08_Cm_125.wav",
|
||||
r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\librerias\organized_samples\loops\vocal\Vox_10_Bm_125.wav",
|
||||
]
|
||||
|
||||
VOCAL_MAIN_POSITIONS = [16.0, 48.0, 80.0, 112.0]
|
||||
VOCAL_TEXTURE_POSITIONS = [0.0, 32.0, 64.0, 96.0]
|
||||
|
||||
LOG_FILE = r"C:\Users\ren\Documents\Ableton\Logs\agent7_vocals.txt"
|
||||
|
||||
def send_command(command_type: str, params: dict = None, timeout: float = 45.0) -> dict:
|
||||
payload = json.dumps({
|
||||
"type": command_type,
|
||||
"params": params or {},
|
||||
}).encode("utf-8") + b"\n"
|
||||
|
||||
with socket.create_connection((HOST, PORT), timeout=timeout) as sock:
|
||||
sock.sendall(payload)
|
||||
reader = sock.makefile("r", encoding="utf-8")
|
||||
line = reader.readline()
|
||||
if not line:
|
||||
raise RuntimeError(f"No response for command: {command_type}")
|
||||
return json.loads(line)
|
||||
|
||||
def log(msg: str):
|
||||
with open(LOG_FILE, "a", encoding="utf-8") as f:
|
||||
f.write(msg + "\n")
|
||||
print(msg)
|
||||
|
||||
def main():
|
||||
log("=" * 60)
|
||||
log("AGENT 7 - VOCAL/CHOIR SPECIALIST")
|
||||
log("=" * 60)
|
||||
|
||||
# Step 1: Set input routing to "No Input" for both tracks
|
||||
log("\n[STEP 1] Setting input routing to 'No Input'...")
|
||||
|
||||
for track_idx, track_name in [(VOCAL_MAIN_TRACK, "VOCAL MAIN"), (VOCAL_TEXTURE_TRACK, "VOCAL TEXTURE")]:
|
||||
try:
|
||||
result = send_command("set_track_input_routing", {"index": track_idx, "routing_name": "No Input"})
|
||||
log(f" Track {track_idx} ({track_name}): {result}")
|
||||
except Exception as e:
|
||||
log(f" ERROR Track {track_idx}: {e}")
|
||||
|
||||
# Step 2: Load VOCAL MAIN samples at key moments
|
||||
log("\n[STEP 2] Loading VOCAL MAIN samples at key moments...")
|
||||
|
||||
for i, (sample_path, position) in enumerate(zip(VOCAL_MAIN_SAMPLES, VOCAL_MAIN_POSITIONS)):
|
||||
try:
|
||||
result = send_command("create_arrangement_audio_pattern", {
|
||||
"track_index": VOCAL_MAIN_TRACK,
|
||||
"file_path": sample_path,
|
||||
"positions": [position],
|
||||
"name": f"Vocal Main {i+1}"
|
||||
})
|
||||
log(f" Position {position}: {sample_path.split(chr(92))[-1]} -> {result.get('status', 'unknown')}")
|
||||
except Exception as e:
|
||||
log(f" ERROR at position {position}: {e}")
|
||||
|
||||
# Step 3: Load VOCAL TEXTURE samples at atmospheric positions
|
||||
log("\n[STEP 3] Loading VOCAL TEXTURE samples at atmospheric positions...")
|
||||
|
||||
for i, (sample_path, position) in enumerate(zip(VOCAL_TEXTURE_SAMPLES, VOCAL_TEXTURE_POSITIONS)):
|
||||
try:
|
||||
result = send_command("create_arrangement_audio_pattern", {
|
||||
"track_index": VOCAL_TEXTURE_TRACK,
|
||||
"file_path": sample_path,
|
||||
"positions": [position],
|
||||
"name": f"Vocal Texture {i+1}"
|
||||
})
|
||||
log(f" Position {position}: {sample_path.split(chr(92))[-1]} -> {result.get('status', 'unknown')}")
|
||||
except Exception as e:
|
||||
log(f" ERROR at position {position}: {e}")
|
||||
|
||||
log("\n" + "=" * 60)
|
||||
log("AGENT 7 COMPLETE - Vocal layers loaded")
|
||||
log("=" * 60)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user