modusa 0.4.10__tar.gz → 0.4.12__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.10 → modusa-0.4.12}/PKG-INFO +1 -1
- {modusa-0.4.10 → modusa-0.4.12}/pyproject.toml +1 -1
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/.DS_Store +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/__init__.py +1 -1
- modusa-0.4.12/src/modusa/tools/ann_loader.py +105 -0
- modusa-0.4.12/tests/.DS_Store +0 -0
- modusa-0.4.10/src/modusa/tools/ann_loader.py +0 -65
- modusa-0.4.10/tests/data/song1.mp3 +0 -0
- modusa-0.4.10/tests/data/song1.wav +0 -0
- modusa-0.4.10/tests/test_generators/audio_waveform.py +0 -11
- modusa-0.4.10/tests/test_generators/test_audio.py +0 -10
- modusa-0.4.10/tests/test_generators/test_ftds.py +0 -10
- modusa-0.4.10/tests/test_generators/test_s1d.py +0 -10
- modusa-0.4.10/tests/test_generators/test_s2d.py +0 -10
- modusa-0.4.10/tests/test_generators/test_s_ax.py +0 -10
- modusa-0.4.10/tests/test_generators/test_signal.py +0 -10
- modusa-0.4.10/tests/test_generators/test_signal_generator.py +0 -10
- modusa-0.4.10/tests/test_generators/test_t_ax.py +0 -10
- modusa-0.4.10/tests/test_generators/test_tds.py +0 -10
- modusa-0.4.10/tests/test_io/audio_player.py +0 -11
- modusa-0.4.10/tests/test_io/plotter.py +0 -11
- modusa-0.4.10/tests/test_models/test_data.py +0 -10
- modusa-0.4.10/tests/test_models/test_t_ax.py +0 -10
- modusa-0.4.10/tests/test_plugins/youtube_audio_loader.py +0 -11
- modusa-0.4.10/tests/test_signals/frequency_domain_signal.py +0 -11
- modusa-0.4.10/tests/test_signals/spectrogram.py +0 -11
- modusa-0.4.10/tests/test_signals/test_axis.py +0 -10
- modusa-0.4.10/tests/test_signals/test_feature_time_domain_signal.py +0 -10
- modusa-0.4.10/tests/test_signals/test_frequency_time_domain_signal.py +0 -10
- modusa-0.4.10/tests/test_signals/test_signal1D.py +0 -10
- modusa-0.4.10/tests/test_signals/test_signal2D.py +0 -10
- modusa-0.4.10/tests/test_signals/test_time_domain_signal.py +0 -10
- modusa-0.4.10/tests/test_signals/test_u_ax.py +0 -10
- modusa-0.4.10/tests/test_signals/test_window_signal.py +0 -10
- modusa-0.4.10/tests/test_signals/time_domain_signal.py +0 -11
- modusa-0.4.10/tests/test_tools/test_audio_converter.py +0 -48
- modusa-0.4.10/tests/test_tools/test_fourier_tranform.py +0 -10
- modusa-0.4.10/tests/test_tools/test_math_ops.py +0 -687
- {modusa-0.4.10 → modusa-0.4.12}/LICENSE.md +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/README.md +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/config.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/decorators.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/generate_docs_source.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/generate_template.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/list_authors.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/list_plugins.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/main.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/generator.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/io.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/model.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/plugin.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/test.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/devtools/templates/tool.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/fonts/NotoSansDevanagari-Regular.ttf +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/__init__.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/audio.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/audio_waveforms.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/base.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/ftds.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/s1d.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/s2d.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/s_ax.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/t_ax.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/generators/tds.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/__init__.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/__pycache__/signal1D.cpython-312.pyc.4443461152 +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/audio.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/base.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/data.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/ftds.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/s1d.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/s2d.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/s_ax.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/t_ax.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/models/tds.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/plugins/__init__.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/plugins/base.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/__init__.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/_plotter_old.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/audio_converter.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/audio_loader.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/audio_player.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/audio_recorder.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/audio_saver.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/base.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/math_ops.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/plotter.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/tools/youtube_downloader.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/.DS_Store +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/__init__.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/config.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/excp.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/logger.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/np_func_cat.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/src/modusa/utils/plot.py +0 -0
- {modusa-0.4.10 → modusa-0.4.12}/tests/__init__.py +0 -0
|
Binary file
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
#---------------------------------
|
|
4
|
+
# Author: Ankit Anand
|
|
5
|
+
# Date: 12/08/25
|
|
6
|
+
# Email: ankit0.anand0@gmail.com
|
|
7
|
+
#---------------------------------
|
|
8
|
+
|
|
9
|
+
def load_ann(path, clip=None):
|
|
10
|
+
"""
|
|
11
|
+
Load annotation from audatity label
|
|
12
|
+
text file and also ctm file.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
path: str
|
|
17
|
+
- label text/ctm file path.
|
|
18
|
+
clip: tuple[number, number] | number | None
|
|
19
|
+
- Incase you clipped the audio signal, this parameter will help clip the annotation.
|
|
20
|
+
- If you clip the audio, say from (10, 20), set the clip to (10, 20).
|
|
21
|
+
- Default: None
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
list[tuple, ...]
|
|
26
|
+
- annotation data structure
|
|
27
|
+
- [(start, end, label), ...]
|
|
28
|
+
"""
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
if not isinstance(path, (str, Path)):
|
|
32
|
+
raise ValueError(f"`path` must be one of (str, Path), got {type(path)}")
|
|
33
|
+
|
|
34
|
+
# Convert to Path object
|
|
35
|
+
path = Path(path)
|
|
36
|
+
|
|
37
|
+
# Check if the path exists
|
|
38
|
+
if not path.exists():
|
|
39
|
+
raise FileExistsError(f"{path} does not exist")
|
|
40
|
+
|
|
41
|
+
ann = [] # This will store the annotation
|
|
42
|
+
|
|
43
|
+
# Clipping the annotation to match with the clipped audio
|
|
44
|
+
if clip is not None:
|
|
45
|
+
# Map clip input to the right format
|
|
46
|
+
if isinstance(clip, int or float):
|
|
47
|
+
clip = (0, clip)
|
|
48
|
+
elif isinstance(clip, tuple) and len(clip) > 1:
|
|
49
|
+
clip = (clip[0], clip[1])
|
|
50
|
+
else:
|
|
51
|
+
raise ValueError(f"Invalid clip type or length: {type(clip)}, len={len(clip)}")
|
|
52
|
+
|
|
53
|
+
if path.suffix == ".txt":
|
|
54
|
+
with open(str(path), "r") as f:
|
|
55
|
+
lines = [line.rstrip("\n") for line in f]
|
|
56
|
+
for line in lines:
|
|
57
|
+
start, end, label = line.split("\t")
|
|
58
|
+
start, end = float(start), float(end)
|
|
59
|
+
|
|
60
|
+
# Incase user has clipped the audio signal, we adjust the annotation
|
|
61
|
+
# to match the clipped audio
|
|
62
|
+
if clip is not None:
|
|
63
|
+
offset = clip[0]
|
|
64
|
+
# Clamp annotation to clip boundaries
|
|
65
|
+
new_start = max(start, clip[0]) - offset
|
|
66
|
+
new_end = min(end, clip[1]) - offset
|
|
67
|
+
|
|
68
|
+
# only keep if there's still overlap
|
|
69
|
+
if new_start < new_end:
|
|
70
|
+
ann.append((new_start, new_end, label))
|
|
71
|
+
else:
|
|
72
|
+
ann.append((start, end, label))
|
|
73
|
+
|
|
74
|
+
elif path.suffix == ".ctm":
|
|
75
|
+
with open(str(path), "r") as f:
|
|
76
|
+
content = f.read().split("\n")
|
|
77
|
+
|
|
78
|
+
for c in content:
|
|
79
|
+
c = c.strip()
|
|
80
|
+
if c == "": # Handle empty line usually at the end of the ctm file
|
|
81
|
+
continue
|
|
82
|
+
elif len(c.split(" ")) != 5:
|
|
83
|
+
warnings.warn(f" '{c}' is not a standard ctm line.")
|
|
84
|
+
if len(c.split(" ")) == 5:
|
|
85
|
+
_, _, start, dur, label = c.split(" ")
|
|
86
|
+
start, dur = float(start), float(dur)
|
|
87
|
+
end = start + dur
|
|
88
|
+
|
|
89
|
+
# Incase user has clipped the audio signal, we adjust the annotation
|
|
90
|
+
# to match the clipped audio
|
|
91
|
+
if clip is not None:
|
|
92
|
+
offset = clip[0]
|
|
93
|
+
# Clamp annotation to clip boundaries
|
|
94
|
+
new_start = max(start, clip[0]) - offset
|
|
95
|
+
new_end = min(end, clip[1]) - offset
|
|
96
|
+
|
|
97
|
+
# only keep if there's still overlap
|
|
98
|
+
if new_start < new_end:
|
|
99
|
+
ann.append((new_start, new_end, label))
|
|
100
|
+
else:
|
|
101
|
+
ann.append((start, end, label))
|
|
102
|
+
|
|
103
|
+
else:
|
|
104
|
+
raise Exception(f"Unsupported file type {path.suffix}")
|
|
105
|
+
return ann
|
|
Binary file
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
#---------------------------------
|
|
4
|
-
# Author: Ankit Anand
|
|
5
|
-
# Date: 12/08/25
|
|
6
|
-
# Email: ankit0.anand0@gmail.com
|
|
7
|
-
#---------------------------------
|
|
8
|
-
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
def load_ann(path, clip=None):
|
|
12
|
-
"""
|
|
13
|
-
Load annotation from audatity label text file.
|
|
14
|
-
|
|
15
|
-
Parameters
|
|
16
|
-
----------
|
|
17
|
-
path: str
|
|
18
|
-
- label text file path.
|
|
19
|
-
clip: tuple[number, number] | number | None
|
|
20
|
-
- Incase you clipped the audio signal, this parameter will help clip the annotation.
|
|
21
|
-
- If you clip the audio, say from (10, 20), set the clip to (10, 20).
|
|
22
|
-
- Default: None
|
|
23
|
-
|
|
24
|
-
Returns
|
|
25
|
-
-------
|
|
26
|
-
list[tuple, ...]
|
|
27
|
-
- annotation data structure
|
|
28
|
-
- [(start, end, tag), ...]
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
if not isinstance(path, (str, Path)):
|
|
32
|
-
raise ValueError(f"`path` must be one of (str, Path), got {type(path)}")
|
|
33
|
-
|
|
34
|
-
if clip is not None:
|
|
35
|
-
# Map clip input to the right format
|
|
36
|
-
if isinstance(clip, int or float):
|
|
37
|
-
clip = (0, clip)
|
|
38
|
-
elif isinstance(clip, tuple) and len(clip) > 1:
|
|
39
|
-
clip = (clip[0], clip[1])
|
|
40
|
-
else:
|
|
41
|
-
raise ValueError(f"Invalid clip type or length: {type(clip)}, len={len(clip)}")
|
|
42
|
-
|
|
43
|
-
ann = []
|
|
44
|
-
|
|
45
|
-
with open(str(path), "r") as f:
|
|
46
|
-
lines = [line.rstrip("\n") for line in f]
|
|
47
|
-
for line in lines:
|
|
48
|
-
start, end, tag = line.split("\t")
|
|
49
|
-
start, end = float(start), float(end)
|
|
50
|
-
|
|
51
|
-
# Incase user has clipped the audio signal, we adjust the annotation
|
|
52
|
-
# to match the clipped audio
|
|
53
|
-
if clip is not None:
|
|
54
|
-
offset = clip[0]
|
|
55
|
-
# Clamp annotation to clip boundaries
|
|
56
|
-
new_start = max(start, clip[0]) - offset
|
|
57
|
-
new_end = min(end, clip[1]) - offset
|
|
58
|
-
|
|
59
|
-
# only keep if there's still overlap
|
|
60
|
-
if new_start < new_end:
|
|
61
|
-
ann.append((new_start, new_end, tag))
|
|
62
|
-
else:
|
|
63
|
-
ann.append((start, end, tag))
|
|
64
|
-
|
|
65
|
-
return ann
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "AudioWaveformGenerator"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-07"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.generators import AudioWaveformGenerator
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "SignalGenerator"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-25"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "TAxGenerator"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-26"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "AudioPlayer"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-08"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.ios import AudioPlayer
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
class_name = "Plotter"
|
|
6
|
-
author_name = "Ankit Anand"
|
|
7
|
-
author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
created_at = "2025-07-06"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.ios import Plotter
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
class_name = "YoutubeAudioLoaderPlugin"
|
|
6
|
-
author_name = "Ankit Anand"
|
|
7
|
-
author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
created_at = "2025-07-05"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.plugins import YoutubeAudioLoaderPlugin
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "FrequencyDomainSignal"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-09"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.signals import FrequencyDomainSignal
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "Spectrogram"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-07"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.signals import Spectrogram
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "FeatureTimeDomainSignal"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-21"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "FrequencyTimeDomainSignal"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-20"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "TimeDomainSignal"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-20"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from modusa import excp
|
|
4
|
-
|
|
5
|
-
#--------Meta Information----------
|
|
6
|
-
_class_name = "WindowSignal"
|
|
7
|
-
_author_name = "Ankit Anand"
|
|
8
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
9
|
-
_created_at = "2025-07-19"
|
|
10
|
-
#----------------------------------
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "TimeDomainSignal"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-09"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
from modusa.signals import TimeDomainSignal
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#--------Meta Information----------
|
|
5
|
-
_class_name = "AudioConverter"
|
|
6
|
-
_author_name = "Ankit Anand"
|
|
7
|
-
_author_email = "ankit0.anand0@gmail.com"
|
|
8
|
-
_created_at = "2025-07-11"
|
|
9
|
-
#----------------------------------
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
from modusa import excp
|
|
13
|
-
from modusa.tools.audio_converter import AudioConverter
|
|
14
|
-
import pytest
|
|
15
|
-
from pathlib import Path
|
|
16
|
-
import shutil
|
|
17
|
-
|
|
18
|
-
TEST_DP = Path(__file__).parents[1].resolve()
|
|
19
|
-
TMP_DP = TEST_DP / "tmp" # To store exported files
|
|
20
|
-
|
|
21
|
-
@pytest.fixture(scope="module", autouse=True)
|
|
22
|
-
def cleanup_dne_dir():
|
|
23
|
-
"""
|
|
24
|
-
This makes sure that the directory after the test
|
|
25
|
-
is automatically deleted.
|
|
26
|
-
"""
|
|
27
|
-
yield
|
|
28
|
-
dne_dir = TEST_DP / "tmp"
|
|
29
|
-
if dne_dir.exists():
|
|
30
|
-
shutil.rmtree(dne_dir)
|
|
31
|
-
|
|
32
|
-
def test_convert_non_exixiting_file():
|
|
33
|
-
with pytest.raises(excp.FileNotFoundError):
|
|
34
|
-
AudioConverter.convert("../dne.wav", "./dne.mp3")
|
|
35
|
-
|
|
36
|
-
def test_convert_non_existing_output_dir():
|
|
37
|
-
AudioConverter.convert(TEST_DP / "data" / "song1.mp3", TEST_DP / "tmp" / "song1.wav")
|
|
38
|
-
|
|
39
|
-
def test_convert_to_same_format():
|
|
40
|
-
AudioConverter.convert(TEST_DP / "data" / "song1.mp3", TEST_DP / "tmp" / "song1.mp3")
|
|
41
|
-
|
|
42
|
-
def test_when_input_fp_same_output_fp():
|
|
43
|
-
with pytest.raises(excp.InputValueError):
|
|
44
|
-
AudioConverter.convert(TEST_DP / "data" / "song1.mp3", TEST_DP / "data" / "song1.mp3")
|
|
45
|
-
|
|
46
|
-
def test_with_none():
|
|
47
|
-
with pytest.raises(excp.InputTypeError):
|
|
48
|
-
AudioConverter.convert(None, None)
|