File size: 1,399 Bytes
b27118b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c901b5f
 
 
 
 
 
 
 
 
 
 
 
 
b27118b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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")