Spaces:
Running
Running
| import numpy as np | |
| from rhythma import RhythmaModulationEngine, RhythmaSymphAICore | |
| def test_analyze_input_maps_stressed_text_to_relaxed_pattern(): | |
| core = RhythmaSymphAICore(use_groq=False, use_embeddings=False) | |
| result = core.analyze_input("feeling stressed about work") | |
| assert result["emotional_state"] == "stressed" | |
| assert result["rhythm_pattern"] == "relaxed" | |
| assert result["transcription"] == "" | |
| assert result["error"] is None | |
| def test_analyze_input_defaults_to_neutral_when_no_text_is_provided(): | |
| core = RhythmaSymphAICore(use_groq=False, use_embeddings=False) | |
| result = core.analyze_input("") | |
| assert result["emotional_state"] == "neutral" | |
| assert result["rhythm_pattern"] == "calm" | |
| assert result["transcription"] == "" | |
| assert result["error"] is None | |
| def test_render_session_has_expected_length_and_headroom(): | |
| engine = RhythmaModulationEngine(emotional_state="stressed", rhythm_pattern="calm") | |
| profile = { | |
| "tone_center": engine.base_freq, | |
| "pattern": "calm", | |
| "modulation_type": "sine", | |
| "brightness": 0.2, | |
| "density": 0.4, | |
| "shimmer": 0.1, | |
| "breath_rate": 0.08, | |
| } | |
| wave = engine.render_session(profile, 0.1) | |
| assert len(wave) == 4410 | |
| assert np.max(np.abs(wave)) <= 0.9 + 1e-9 | |
| assert engine.get_symbolic_interpretation().startswith("Resonating in the Circle") | |