Coverage for integrations / service_tools / diffrhythm_tool.py: 0.0%

10 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-12 04:49 +0000

1""" 

2DiffRhythm tool wrapper — AI singing voice synthesis. 

3 

4Service: DiffRhythm (singing voice, vocal synthesis with lyrics) 

5Default port: 8002 

6VRAM: 4GB GPU required 

7""" 

8 

9from .registry import ServiceToolInfo, service_tool_registry 

10 

11 

12class DiffRhythmTool: 

13 """Thin wrapper to register DiffRhythm with the ServiceToolRegistry.""" 

14 

15 DEFAULT_URL = "http://localhost:8002" 

16 

17 @classmethod 

18 def create_tool_info(cls, base_url: str = None) -> ServiceToolInfo: 

19 return ServiceToolInfo( 

20 name="diffrhythm", 

21 description=( 

22 "AI singing voice synthesis. Generates sung vocals from lyrics " 

23 "with melody, rhythm, and vocal style control. Produces natural " 

24 "singing audio from text lyrics and style prompts." 

25 ), 

26 base_url=base_url or cls.DEFAULT_URL, 

27 endpoints={ 

28 "generate": { 

29 "path": "/generate", 

30 "method": "POST", 

31 "description": ( 

32 "Generate singing audio from lyrics. " 

33 "Input: JSON with 'lyrics' (text to sing), " 

34 "'style' (vocal style: pop/opera/folk/etc), " 

35 "'tempo' (BPM), 'duration' (seconds). " 

36 "Returns audio URL when complete." 

37 ), 

38 "params_schema": { 

39 "lyrics": {"type": "string", "description": "Lyrics to sing"}, 

40 "style": {"type": "string", "description": "Vocal style (pop, opera, folk, ballad)", "default": "pop"}, 

41 "tempo": {"type": "integer", "description": "BPM tempo", "default": 120}, 

42 "duration": {"type": "integer", "description": "Duration in seconds", "default": 30}, 

43 }, 

44 }, 

45 }, 

46 health_endpoint="/health", 

47 tags=["singing", "vocals", "audio", "generation", "music"], 

48 timeout=120, 

49 ) 

50 

51 @classmethod 

52 def register(cls, base_url: str = None) -> bool: 

53 """Register DiffRhythm with the global service_tool_registry.""" 

54 tool_info = cls.create_tool_info(base_url) 

55 return service_tool_registry.register_tool(tool_info)