modusa 0.4.24__tar.gz → 0.4.27__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.
Files changed (72) hide show
  1. {modusa-0.4.24 → modusa-0.4.27}/PKG-INFO +1 -1
  2. {modusa-0.4.24 → modusa-0.4.27}/pyproject.toml +19 -1
  3. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/__init__.py +1 -1
  4. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/audio_loader.py +10 -3
  5. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/plotter.py +3 -3
  6. modusa-0.4.24/src/modusa/.DS_Store +0 -0
  7. modusa-0.4.24/tests/.DS_Store +0 -0
  8. modusa-0.4.24/tests/__init__.py +0 -0
  9. modusa-0.4.24/tests/test_load.py +0 -158
  10. modusa-0.4.24/tests/testdata/.DS_Store +0 -0
  11. modusa-0.4.24/tests/testdata/audio-formats/sample.aac +0 -0
  12. modusa-0.4.24/tests/testdata/audio-formats/sample.aiff +0 -0
  13. modusa-0.4.24/tests/testdata/audio-formats/sample.flac +0 -0
  14. modusa-0.4.24/tests/testdata/audio-formats/sample.m4a +0 -0
  15. modusa-0.4.24/tests/testdata/audio-formats/sample.mp3 +0 -0
  16. modusa-0.4.24/tests/testdata/audio-formats/sample.opus +0 -0
  17. modusa-0.4.24/tests/testdata/audio-formats/sample.wav +0 -0
  18. {modusa-0.4.24 → modusa-0.4.27}/LICENSE.md +0 -0
  19. {modusa-0.4.24 → modusa-0.4.27}/README.md +0 -0
  20. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/config.py +0 -0
  21. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/decorators.py +0 -0
  22. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/generate_docs_source.py +0 -0
  23. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/generate_template.py +0 -0
  24. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/list_authors.py +0 -0
  25. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/list_plugins.py +0 -0
  26. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/main.py +0 -0
  27. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/generator.py +0 -0
  28. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/io.py +0 -0
  29. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/model.py +0 -0
  30. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/plugin.py +0 -0
  31. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/test.py +0 -0
  32. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/devtools/templates/tool.py +0 -0
  33. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/fonts/NotoSansDevanagari-Regular.ttf +0 -0
  34. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/__init__.py +0 -0
  35. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/audio.py +0 -0
  36. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/audio_waveforms.py +0 -0
  37. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/base.py +0 -0
  38. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/ftds.py +0 -0
  39. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/s1d.py +0 -0
  40. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/s2d.py +0 -0
  41. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/s_ax.py +0 -0
  42. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/t_ax.py +0 -0
  43. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/generators/tds.py +0 -0
  44. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/images/icon.png +0 -0
  45. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/__init__.py +0 -0
  46. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/audio.py +0 -0
  47. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/base.py +0 -0
  48. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/data.py +0 -0
  49. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/ftds.py +0 -0
  50. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/s1d.py +0 -0
  51. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/s2d.py +0 -0
  52. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/s_ax.py +0 -0
  53. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/t_ax.py +0 -0
  54. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/models/tds.py +0 -0
  55. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/plugins/__init__.py +0 -0
  56. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/plugins/base.py +0 -0
  57. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/__init__.py +0 -0
  58. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/_plotter_old.py +0 -0
  59. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/ann_loader.py +0 -0
  60. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/audio_converter.py +0 -0
  61. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/audio_player.py +0 -0
  62. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/audio_recorder.py +0 -0
  63. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/audio_saver.py +0 -0
  64. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/base.py +0 -0
  65. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/math_ops.py +0 -0
  66. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/tools/youtube_downloader.py +0 -0
  67. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/__init__.py +0 -0
  68. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/config.py +0 -0
  69. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/excp.py +0 -0
  70. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/logger.py +0 -0
  71. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/np_func_cat.py +0 -0
  72. {modusa-0.4.24 → modusa-0.4.27}/src/modusa/utils/plot.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modusa
3
- Version: 0.4.24
3
+ Version: 0.4.27
4
4
  Summary: A modular signal analysis python library.
5
5
  Author-Email: Ankit Anand <ankit0.anand0@gmail.com>
6
6
  License: MIT
@@ -16,7 +16,7 @@ dependencies = [
16
16
  ]
17
17
  requires-python = ">=3.11"
18
18
  readme = "README.md"
19
- version = "0.4.24"
19
+ version = "0.4.27"
20
20
 
21
21
  [project.license]
22
22
  text = "MIT"
@@ -60,6 +60,24 @@ misc = [
60
60
  [tool.pdm.package-dir]
61
61
  "" = "src"
62
62
 
63
+ [tool.pdm.build]
64
+ includes = [
65
+ "src",
66
+ "README.md",
67
+ "LICENSE.md",
68
+ "pyproject.toml",
69
+ ]
70
+ excludes = [
71
+ "tests/**",
72
+ "**/.DS_Store",
73
+ "__pycache__/**",
74
+ "*.pyc",
75
+ "dist",
76
+ "build",
77
+ ".venv",
78
+ ".git",
79
+ ]
80
+
63
81
  [build-system]
64
82
  requires = [
65
83
  "pdm-backend",
@@ -8,4 +8,4 @@ from modusa.tools import play, convert, record, save
8
8
  from modusa.tools import download
9
9
  from modusa.tools import load, load_ann
10
10
 
11
- __version__ = "0.4.24"
11
+ __version__ = "0.4.27"
@@ -99,12 +99,19 @@ def load(path, sr=None, trim=None, ch=None):
99
99
  File name stem.
100
100
  """
101
101
  path = Path(path)
102
- ffmpeg_exe = ffmpeg.get_ffmpeg_exe()
103
-
104
- yt = False # Is the path a youtube URL
105
102
 
103
+ # If the path is a YouTube URL, turn on the yt flag
104
+ yt = False # By default, set to false
106
105
  if ".youtube" in str(path):
107
106
  yt = True
107
+
108
+ # For local files, check if the audio exists
109
+ elif not path.exists():
110
+ raise FileExistsError(f"{path} does not exist")
111
+
112
+ ffmpeg_exe = ffmpeg.get_ffmpeg_exe()
113
+
114
+ if yt:
108
115
  try:
109
116
  path: Path = _load_audio_from_youtube(url=str(path))
110
117
  except Exception as e:
@@ -31,7 +31,7 @@ def _load_devanagari_font():
31
31
  hindi_font = fm.FontProperties(fname=str(font_path))
32
32
 
33
33
  # Set as default rcParam
34
- mpl.rcParams['font.family'] = hindi_font.get_name()
34
+ mpl.rcParams['font.family'] = [hindi_font.get_name(), 'DejaVu Sans'] # Fallback to DejaVu Sans
35
35
 
36
36
  #==============
37
37
 
@@ -539,7 +539,7 @@ class Fig:
539
539
  text_obj = curr_row[0].text(
540
540
  (start + end) / 2, text_yloc, tag,
541
541
  ha='center', va='center',
542
- fontsize=10, color="black", fontweight='bold', zorder=10, clip_on=True
542
+ fontsize=9, color="black", zorder=10, clip_on=True
543
543
  )
544
544
 
545
545
  text_obj.set_clip_path(rect)
@@ -556,7 +556,7 @@ class Fig:
556
556
  text_obj = curr_row[0].text(
557
557
  (start + end) / 2, text_yloc, tag,
558
558
  ha='center', va='center',
559
- fontsize=10, color="black", fontweight='bold', zorder=10, clip_on=True
559
+ fontsize=9, color="black", zorder=10, clip_on=True
560
560
  )
561
561
 
562
562
  text_obj.set_clip_path(rect)
Binary file
Binary file
File without changes
@@ -1,158 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- #---------------------------------
4
- # Author: Ankit Anand
5
- # Date: 21/10/25
6
- # Email: ankit0.anand0@gmail.com
7
- #---------------------------------
8
-
9
- import pytest
10
- import modusa as ms
11
- from pathlib import Path
12
-
13
-
14
- #----------------------------------
15
- # Loading different audio formats
16
- #----------------------------------
17
- this_dir = Path(__file__).parents[0].resolve()
18
- def test_load_aac():
19
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aac")
20
- assert title == "sample"
21
-
22
- def test_load_aiff():
23
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aiff")
24
- assert title == "sample"
25
-
26
- def test_load_flac():
27
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.flac")
28
- assert title == "sample"
29
-
30
- def test_load_m4a():
31
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.m4a")
32
- assert title == "sample"
33
-
34
- def test_load_mp3():
35
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.mp3")
36
- assert title == "sample"
37
-
38
- def test_load_opus():
39
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.opus")
40
- assert title == "sample"
41
-
42
- def test_load_wav():
43
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.wav")
44
- assert title == "sample"
45
-
46
- #----------------------------------
47
- # Resampe feature
48
- #----------------------------------
49
- SR = 16000 # Hz
50
- def test_load_with_resample_aac():
51
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aac", sr=SR)
52
- assert sr == SR
53
- assert title == "sample"
54
-
55
- def test_load_with_resample_aiff():
56
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aiff", sr=SR)
57
- assert sr == SR
58
- assert title == "sample"
59
-
60
- def test_load_with_resample_flac():
61
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.flac", sr=SR)
62
- assert sr == SR
63
- assert title == "sample"
64
-
65
- def test_load_with_resample_m4a():
66
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.m4a", sr=SR)
67
- assert sr == SR
68
- assert title == "sample"
69
-
70
- def test_load_with_resample_mp3():
71
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.mp3", sr=SR)
72
- assert sr == SR
73
- assert title == "sample"
74
-
75
- def test_load_with_resample_opus():
76
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.opus", sr=SR)
77
- assert sr == SR
78
- assert title == "sample"
79
-
80
- def test_load_with_resample_wav():
81
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.wav", sr=SR)
82
- assert sr == SR
83
- assert title == "sample"
84
-
85
- #----------------------------------
86
- # Trim feature
87
- #----------------------------------
88
- def test_load_with_trim_aac():
89
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aac", trim=(0, 5.3))
90
- assert title == "sample"
91
-
92
- def test_load_with_trim_aiff():
93
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aiff", trim=(0, 5.3))
94
- assert title == "sample"
95
-
96
- def test_load_with_trim_flac():
97
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.flac", trim=(0, 5.3))
98
- assert title == "sample"
99
-
100
- def test_load_with_trim_m4a():
101
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.m4a", trim=(0, 5.3))
102
- assert title == "sample"
103
-
104
- def test_load_with_trim_mp3():
105
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.mp3", trim=(0, 5.3))
106
- assert title == "sample"
107
-
108
- def test_load_with_trim_opus():
109
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.opus", trim=(0, 5.3))
110
- assert title == "sample"
111
-
112
- def test_load_with_trim_wav():
113
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.wav", trim=(0, 5.3))
114
- assert title == "sample"
115
-
116
- #----------------------------------
117
- # Mono feature
118
- #----------------------------------
119
- def test_load_in_stereo_aac():
120
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aac", ch=2)
121
- assert y.ndim == 2
122
- assert title == "sample"
123
-
124
- def test_load_in_stereo_aiff():
125
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.aiff", ch=2)
126
- assert y.ndim == 2
127
- assert title == "sample"
128
-
129
- def test_load_in_stereo_flac():
130
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.flac", ch=2)
131
- assert y.ndim == 2
132
- assert title == "sample"
133
-
134
- def test_load_in_stereo_m4a():
135
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.m4a", ch=2)
136
- assert y.ndim == 2
137
- assert title == "sample"
138
-
139
- def test_load_in_stereo_mp3():
140
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.mp3", ch=2)
141
- assert y.ndim == 2
142
- assert title == "sample"
143
-
144
- def test_load_in_stereo_opus():
145
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.opus", ch=2)
146
- assert y.ndim == 2
147
- assert title == "sample"
148
-
149
- def test_load_in_stereo_wav():
150
- y, sr, title = ms.load(this_dir / "testdata/audio-formats/sample.wav", ch=2)
151
- assert y.ndim == 2
152
- assert title == "sample"
153
-
154
- #----------------------------------
155
- # Load from YouTube
156
- #----------------------------------
157
- def test_load_youtube_1():
158
- y, sr, title = ms.load("https://www.youtube.com/watch?v=DIU_vmElPkU", ch=1)
Binary file
File without changes
File without changes
File without changes