maialib 1.5.0__cp311-cp311-musllinux_1_2_x86_64.whl

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.

Potentially problematic release.


This version of maialib might be problematic. Click here for more details.

@@ -0,0 +1,3 @@
1
+ from .other import *
2
+ from .plots import *
3
+ from .sethares_dissonance import *
@@ -0,0 +1,3 @@
1
+ from .other import *
2
+ from .plots import *
3
+ from .sethares_dissonance import *
@@ -0,0 +1,131 @@
1
+ import os
2
+ import pkg_resources
3
+ from enum import Enum
4
+ import platform
5
+ import subprocess
6
+ import maialib.maiacore as mc
7
+
8
+ __all__ = ["getSampleScorePath", "SampleScore",
9
+ "setScoreEditorApp", "getScoreEditorApp", "openScore", "getXmlSamplesDirPath"]
10
+
11
+ _scoreEditorApp = ""
12
+
13
+
14
+ def setScoreEditorApp(executableFullPath: str) -> None:
15
+ """Set the full path to the installed score editor app
16
+
17
+ Args:
18
+ executableFullPath (str): Score editor full path
19
+ Example 01: "C:/path/to/MuseScore"
20
+ Example 02: "/Applications/MuseScore 4.app/Contents/MacOS/mscore"
21
+
22
+ Examples of use:
23
+
24
+ >>> import maialib as ml
25
+ >>> # Example for Windows:
26
+ >>> ml.setScoreEditorApp("C:/path/to/MuseScore.exe")
27
+ >>> # Example for Mac OSX:
28
+ >>> ml.setScoreEditorApp("/Applications/MuseScore 4.app/Contents/MacOS/mscore")
29
+ """
30
+ global _scoreEditorApp
31
+
32
+ if (os.path.isfile(executableFullPath)):
33
+ _scoreEditorApp = executableFullPath
34
+ else:
35
+ raise ValueError('Invalid executable full path')
36
+
37
+
38
+ def getScoreEditorApp() -> str:
39
+ global _scoreEditorApp
40
+ return _scoreEditorApp
41
+
42
+
43
+ def openScore(score: mc.Score) -> None:
44
+ score.toFile("temp")
45
+ global _scoreEditorApp
46
+
47
+ if not _scoreEditorApp:
48
+ raise RuntimeError(
49
+ "Please, set your installed music score editor using the 'setScoreEditorApp' function")
50
+
51
+ print(f"Opening Score Editor App: {_scoreEditorApp}")
52
+ ret = subprocess.Popen([_scoreEditorApp, "temp.xml"])
53
+ ret.wait()
54
+
55
+
56
+ class SampleScore(Enum):
57
+ Bach_Cello_Suite_1 = "Bach_Cello_Suite_1"
58
+ Beethoven_Symphony_5th = "Beethoven_Symphony_5th"
59
+ Chopin_Fantasie_Impromptu = "Chopin_Fantasie_Impromptu"
60
+ Dvorak_Symphony_9_mov_4 = "Dvorak_Symphony_9_mov_4"
61
+ Mahler_Symphony_8_Finale = "Mahler_Symphony_8_Finale"
62
+ Mozart_Requiem_Introitus = "Mozart_Requiem_Introitus"
63
+ Strauss_Also_Sprach_Zarathustra = "Strauss_Also_Sprach_Zarathustra"
64
+
65
+
66
+ def getSampleScorePath(sampleEnum: SampleScore) -> str:
67
+ """Get a maialib internal XML sample file
68
+
69
+ Args:
70
+ sampleEnum (SampleScore): Maialib SampleScore enum value
71
+ - Bach_Cello_Suite_1
72
+ - Beethoven_Symphony_5th
73
+ - Chopin_Fantasie_Impromptu
74
+ - Dvorak_Symphony_9_mov_4
75
+ - Mahler_Symphony_8_Finale
76
+ - Mozart_Requiem_Introitus
77
+ - Strauss_Also_Sprach_Zarathustra
78
+
79
+ Kwargs:
80
+ None
81
+
82
+ Returns:
83
+ A full file path (str) to the XML maialib internal sample score
84
+
85
+ Raises:
86
+ RuntimeError
87
+
88
+ Examples of use:
89
+
90
+ >>> import maialib as ml
91
+ >>> filePath = ml.getSampleScorePath(ml.SampleScore.Bach_Cello_Suite_1)
92
+ >>> score = ml.Score(filePath)
93
+ >>> score.info()
94
+ """
95
+ # Get the actual XML file name for the given 'alias'
96
+ xmlFileName = {
97
+ SampleScore.Bach_Cello_Suite_1: "Bach_Cello_Suite_1.mxl",
98
+ SampleScore.Beethoven_Symphony_5th: "Beethoven_Symphony_5_mov_1.xml",
99
+ SampleScore.Chopin_Fantasie_Impromptu: "Chopin_Fantasie_Impromptu.mxl",
100
+ SampleScore.Dvorak_Symphony_9_mov_4: "Dvorak_Symphony_9_mov_4.mxl",
101
+ SampleScore.Mahler_Symphony_8_Finale: "Mahler_Symphony_8_Finale.mxl",
102
+ SampleScore.Mozart_Requiem_Introitus: "Mozart_Requiem_Introitus.mxl",
103
+ SampleScore.Strauss_Also_Sprach_Zarathustra: "Strauss_Also_Sprach_Zarathustra.mxl"
104
+ }[sampleEnum]
105
+
106
+ xmlDir = pkg_resources.resource_filename("maialib", "xml-scores-examples")
107
+ fileFullPath = os.path.join(xmlDir, xmlFileName)
108
+ return fileFullPath
109
+
110
+
111
+ def getXmlSamplesDirPath() -> str:
112
+ """Get the maialib XML samples directory path
113
+
114
+ Kwargs:
115
+ None
116
+
117
+ Returns:
118
+ A full dir path (str) to the XML maialib internal samples score directory
119
+
120
+ Raises:
121
+ RuntimeError
122
+
123
+ Examples of use:
124
+
125
+ >>> import maialib as ml
126
+ >>> xmlDir = ml.getXmlSamplesDirPath()
127
+ >>> score = ml.Score(xmlDir + "Bach/cello_suite_1_violin.xml")
128
+ >>> score.info()
129
+ """
130
+ xmlDir = pkg_resources.resource_filename("maialib", "xml-scores-examples")
131
+ return xmlDir
@@ -0,0 +1,20 @@
1
+ import maialib.maiacore as mc
2
+ from enum import Enum
3
+
4
+ __all__ = ['getSampleScorePath', 'SampleScore', 'setScoreEditorApp', 'getScoreEditorApp', 'openScore', 'getXmlSamplesDirPath']
5
+
6
+ def setScoreEditorApp(executableFullPath: str) -> None: ...
7
+ def getScoreEditorApp() -> str: ...
8
+ def openScore(score: mc.Score) -> None: ...
9
+
10
+ class SampleScore(Enum):
11
+ Bach_Cello_Suite_1: str
12
+ Beethoven_Symphony_5th: str
13
+ Chopin_Fantasie_Impromptu: str
14
+ Dvorak_Symphony_9_mov_4: str
15
+ Mahler_Symphony_8_Finale: str
16
+ Mozart_Requiem_Introitus: str
17
+ Strauss_Also_Sprach_Zarathustra: str
18
+
19
+ def getSampleScorePath(sampleEnum: SampleScore) -> str: ...
20
+ def getXmlSamplesDirPath() -> str: ...