| |
| """ |
| engine_standard.py – Standard Beat Tools Module |
| Wraps standard_engine.generate_standard_audio for the Factory UI. |
| """ |
|
|
| import os |
| from pathlib import Path |
| from standard_engine import generate_standard_audio, BEAT_STYLES, HUMAN_FEELS |
| from utils import logger |
|
|
| def run_standard_beat_tools(image_path, style, seed, duration, noise_filter, prompt_text, bpm, |
| export_stems, export_midi, |
| mix_kick, mix_snare, mix_hats, mix_bass, mix_melody, |
| complexity, density, human_feel, swing_amount, fill_frequency): |
| """ |
| Run Standard Beat Tools engine with full mix and groove controls. |
| Returns (log_message, audio_path, list_of_files). |
| """ |
| if not image_path or not os.path.exists(image_path): |
| return "❌ No valid image provided.", None, [] |
|
|
| |
| if style not in BEAT_STYLES: |
| style = "cinematic" |
|
|
| try: |
| out_path, downloadable, log = generate_standard_audio( |
| image_path, style, seed, duration, noise_filter, bpm, |
| prompt_text, export_stems, export_midi, |
| mix_kick, mix_snare, mix_hats, mix_bass, mix_melody, |
| complexity, density, human_feel, swing_amount, fill_frequency |
| ) |
| return log, out_path, downloadable |
| except Exception as e: |
| logger.error(f"Standard engine error: {e}", exc_info=True) |
| return f"❌ Standard Engine Error: {str(e)}", None, [] |