modusa 0.4.18__tar.gz → 0.4.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {modusa-0.4.18 → modusa-0.4.20}/PKG-INFO +1 -1
- {modusa-0.4.18 → modusa-0.4.20}/pyproject.toml +1 -1
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/__init__.py +1 -1
- modusa-0.4.20/src/modusa/images/icon.png +0 -0
- modusa-0.4.20/src/modusa/tools/audio_player.py +95 -0
- modusa-0.4.18/src/modusa/tools/audio_player.py +0 -60
- {modusa-0.4.18 → modusa-0.4.20}/LICENSE.md +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/README.md +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/config.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/decorators.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/generate_docs_source.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/generate_template.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/list_authors.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/list_plugins.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/main.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/generator.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/io.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/model.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/plugin.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/test.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/devtools/templates/tool.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/fonts/NotoSansDevanagari-Regular.ttf +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/__init__.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/audio.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/audio_waveforms.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/base.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/ftds.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/s1d.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/s2d.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/s_ax.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/t_ax.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/generators/tds.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/__init__.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/audio.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/base.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/data.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/ftds.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/s1d.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/s2d.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/s_ax.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/t_ax.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/models/tds.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/plugins/__init__.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/plugins/base.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/__init__.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/_plotter_old.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/ann_loader.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/audio_converter.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/audio_loader.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/audio_recorder.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/audio_saver.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/base.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/math_ops.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/plotter.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/tools/youtube_downloader.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/__init__.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/config.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/excp.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/logger.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/np_func_cat.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/src/modusa/utils/plot.py +0 -0
- {modusa-0.4.18 → modusa-0.4.20}/tests/__init__.py +0 -0
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from IPython.display import Audio, HTML, display
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import numpy as np
|
|
6
|
+
import base64
|
|
7
|
+
|
|
8
|
+
def play(
|
|
9
|
+
y: np.ndarray,
|
|
10
|
+
sr: float,
|
|
11
|
+
clip: tuple[float, float] | None = None,
|
|
12
|
+
label: str | None = None,
|
|
13
|
+
) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Audio player with optional clip selection, transcription-style label,
|
|
16
|
+
and an embedded bottom-right logo (../images/icon.png).
|
|
17
|
+
"""
|
|
18
|
+
start_time, end_time = 0.0, len(y) / sr
|
|
19
|
+
|
|
20
|
+
# Optional clip selection
|
|
21
|
+
if clip is not None:
|
|
22
|
+
if not isinstance(clip, tuple) or len(clip) != 2:
|
|
23
|
+
raise ValueError("`clip` must be a tuple of (start_time, end_time)")
|
|
24
|
+
start_sample = int(clip[0] * sr)
|
|
25
|
+
end_sample = int(clip[1] * sr)
|
|
26
|
+
y = y[start_sample:end_sample]
|
|
27
|
+
start_time, end_time = clip
|
|
28
|
+
|
|
29
|
+
# Load and embed logo image as base64
|
|
30
|
+
logo_path = Path(__file__).resolve().parent.parent / "images" / "icon.png"
|
|
31
|
+
logo_size = 40
|
|
32
|
+
logo_html = ""
|
|
33
|
+
logo_link = "https://meluron.github.io/modusa"
|
|
34
|
+
|
|
35
|
+
if logo_path.exists():
|
|
36
|
+
with open(logo_path, "rb") as f:
|
|
37
|
+
encoded_logo = base64.b64encode(f.read()).decode("utf-8")
|
|
38
|
+
|
|
39
|
+
# Wrap logo in <a> so it's clickable
|
|
40
|
+
logo_html = f"""
|
|
41
|
+
<a href="{logo_link}" target="_blank" style="text-decoration:none;">
|
|
42
|
+
<img src="data:image/png;base64,{encoded_logo}"
|
|
43
|
+
style="
|
|
44
|
+
position:absolute;
|
|
45
|
+
bottom:8px;
|
|
46
|
+
right:10px;
|
|
47
|
+
width:{logo_size}px;
|
|
48
|
+
height:{logo_size}px;
|
|
49
|
+
opacity:0.8;
|
|
50
|
+
transition:opacity 0.2s ease;
|
|
51
|
+
"
|
|
52
|
+
onmouseover="this.style.opacity=1.0"
|
|
53
|
+
onmouseout="this.style.opacity=0.8"
|
|
54
|
+
/>
|
|
55
|
+
</a>
|
|
56
|
+
"""
|
|
57
|
+
audio_html = Audio(data=y, rate=sr)._repr_html_()
|
|
58
|
+
|
|
59
|
+
label_html = f"""
|
|
60
|
+
<div style="
|
|
61
|
+
margin-top:4px;
|
|
62
|
+
padding:10px 12px;
|
|
63
|
+
background:#f7f7f7;
|
|
64
|
+
border-radius:6px;
|
|
65
|
+
color:#222;
|
|
66
|
+
font-size:14px;
|
|
67
|
+
line-height:1.5;
|
|
68
|
+
">
|
|
69
|
+
<strong>{start_time:.2f}s → {end_time:.2f}s:</strong>
|
|
70
|
+
<span style="margin-left:6px;">{label if label else ''}</span>
|
|
71
|
+
</div>
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
html = f"""
|
|
75
|
+
<div style="
|
|
76
|
+
display:inline-block;
|
|
77
|
+
position:relative;
|
|
78
|
+
border:1px solid #e0e0e0;
|
|
79
|
+
border-radius:10px;
|
|
80
|
+
padding:14px 18px 36px 18px;
|
|
81
|
+
background:#fff;
|
|
82
|
+
font-family:sans-serif;
|
|
83
|
+
max-width:520px;
|
|
84
|
+
box-shadow:0 1px 3px rgba(0,0,0,0.05);
|
|
85
|
+
">
|
|
86
|
+
{label_html}
|
|
87
|
+
<div style="margin-top:10px;">
|
|
88
|
+
{audio_html}
|
|
89
|
+
</div>
|
|
90
|
+
{logo_html}
|
|
91
|
+
</div>
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
display(HTML(html))
|
|
95
|
+
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from IPython.display import Audio, HTML, display
|
|
4
|
-
import numpy as np
|
|
5
|
-
|
|
6
|
-
from IPython.display import Audio, HTML, display
|
|
7
|
-
import numpy as np
|
|
8
|
-
|
|
9
|
-
def play(y: np.ndarray, sr: float, clip: tuple[float, float] | None = None, label: str | None = None) -> None:
|
|
10
|
-
"""
|
|
11
|
-
Audio player with optional clip selection and transcription-style label.
|
|
12
|
-
Displays a clean caption box with bold timing and text, followed by the player.
|
|
13
|
-
"""
|
|
14
|
-
start_time, end_time = 0.0, len(y) / sr
|
|
15
|
-
|
|
16
|
-
# Optional clip selection
|
|
17
|
-
if clip is not None:
|
|
18
|
-
if not isinstance(clip, tuple) or len(clip) != 2:
|
|
19
|
-
raise ValueError("`clip` must be a tuple of (start_time, end_time)")
|
|
20
|
-
start_sample = int(clip[0] * sr)
|
|
21
|
-
end_sample = int(clip[1] * sr)
|
|
22
|
-
y = y[start_sample:end_sample]
|
|
23
|
-
start_time, end_time = clip
|
|
24
|
-
|
|
25
|
-
# Build HTML
|
|
26
|
-
audio_html = Audio(data=y, rate=sr)._repr_html_()
|
|
27
|
-
label_html = f"""
|
|
28
|
-
<div style="
|
|
29
|
-
margin-top:4px;
|
|
30
|
-
padding:10px 12px;
|
|
31
|
-
background:#f7f7f7;
|
|
32
|
-
border-radius:6px;
|
|
33
|
-
color:#222;
|
|
34
|
-
font-size:14px;
|
|
35
|
-
line-height:1.5;
|
|
36
|
-
">
|
|
37
|
-
<strong>{start_time:.2f}s → {end_time:.2f}s:</strong>
|
|
38
|
-
<span style="margin-left:6px;">{label if label else ''}</span>
|
|
39
|
-
</div>
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
html = f"""
|
|
43
|
-
<div style="
|
|
44
|
-
display:inline-block;
|
|
45
|
-
border:1px solid #e0e0e0;
|
|
46
|
-
border-radius:10px;
|
|
47
|
-
padding:12px 16px;
|
|
48
|
-
background:#fff;
|
|
49
|
-
font-family:sans-serif;
|
|
50
|
-
max-width:800px;
|
|
51
|
-
box-shadow:0 1px 3px rgba(0,0,0,0.05);
|
|
52
|
-
">
|
|
53
|
-
{label_html}
|
|
54
|
-
<div style="margin-top:10px;">
|
|
55
|
-
{audio_html}
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
display(HTML(html))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|