maialib 1.10.2__cp311-cp311-win_amd64.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.
- maialib/__init__.py +4 -0
- maialib/maiacore/Release/__init__.pyi +3 -0
- maialib/maiacore/Release/maiacore.cp311-win_amd64.pyd +0 -0
- maialib/maiacore/Release/maiacore.pyi +1414 -0
- maialib/maiacore/__init__.py +4 -0
- maialib/maiacore/__init__.pyi +24 -0
- maialib/maiapy/__init__.py +3 -0
- maialib/maiapy/__init__.pyi +3 -0
- maialib/maiapy/other.py +148 -0
- maialib/maiapy/other.pyi +79 -0
- maialib/maiapy/plots.py +806 -0
- maialib/maiapy/plots.pyi +103 -0
- maialib/maiapy/sethares_dissonance.py +481 -0
- maialib/maiapy/sethares_dissonance.pyi +128 -0
- maialib/setup.py +61 -0
- maialib/xml-scores-examples/Bach_Cello_Suite_1.mxl +0 -0
- maialib/xml-scores-examples/Beethoven_Symphony_5_mov_1.xml +170525 -0
- maialib/xml-scores-examples/Chopin_Fantasie_Impromptu.mxl +0 -0
- maialib/xml-scores-examples/Dvorak_Symphony_9_mov_4.mxl +0 -0
- maialib/xml-scores-examples/Mahler_Symphony_8_Finale.mxl +0 -0
- maialib/xml-scores-examples/Mozart_Requiem_Introitus.mxl +0 -0
- maialib/xml-scores-examples/Strauss_Also_Sprach_Zarathustra.mxl +0 -0
- maialib-1.10.2.dist-info/METADATA +822 -0
- maialib-1.10.2.dist-info/RECORD +27 -0
- maialib-1.10.2.dist-info/WHEEL +5 -0
- maialib-1.10.2.dist-info/licenses/LICENSE.txt +674 -0
- maialib-1.10.2.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from maialib.maiacore.Release.maiacore import Barline
|
|
3
|
+
from maialib.maiacore.Release.maiacore import Chord
|
|
4
|
+
from maialib.maiacore.Release.maiacore import Clef
|
|
5
|
+
from maialib.maiacore.Release.maiacore import ClefSign
|
|
6
|
+
from maialib.maiacore.Release.maiacore import HeapData
|
|
7
|
+
from maialib.maiacore.Release.maiacore import Helper
|
|
8
|
+
from maialib.maiacore.Release.maiacore import Interval
|
|
9
|
+
from maialib.maiacore.Release.maiacore import Key
|
|
10
|
+
from maialib.maiacore.Release.maiacore import Measure
|
|
11
|
+
from maialib.maiacore.Release.maiacore import Note
|
|
12
|
+
from maialib.maiacore.Release.maiacore import NoteData
|
|
13
|
+
from maialib.maiacore.Release.maiacore import NoteDataHeap
|
|
14
|
+
from maialib.maiacore.Release.maiacore import Part
|
|
15
|
+
from maialib.maiacore.Release.maiacore import RhythmFigure
|
|
16
|
+
from maialib.maiacore.Release.maiacore import Score
|
|
17
|
+
from maialib.maiacore.Release.maiacore import ScoreCollection
|
|
18
|
+
from maialib.maiacore.Release.maiacore import TimeSignature
|
|
19
|
+
from . import Release
|
|
20
|
+
__all__ = ['Barline', 'C', 'Chord', 'Clef', 'ClefSign', 'F', 'G', 'HeapData', 'Helper', 'Interval', 'Key', 'Measure', 'Note', 'NoteData', 'NoteDataHeap', 'P', 'Part', 'Release', 'RhythmFigure', 'Score', 'ScoreCollection', 'TimeSignature']
|
|
21
|
+
C: Release.maiacore.ClefSign # value = <ClefSign.C: 2>
|
|
22
|
+
F: Release.maiacore.ClefSign # value = <ClefSign.F: 1>
|
|
23
|
+
G: Release.maiacore.ClefSign # value = <ClefSign.G: 0>
|
|
24
|
+
P: Release.maiacore.ClefSign # value = <ClefSign.P: 3>
|
maialib/maiapy/other.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from enum import Enum
|
|
4
|
+
import subprocess
|
|
5
|
+
import maialib.maiacore as mc
|
|
6
|
+
import importlib.resources as pkg_resources
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"getSampleScorePath",
|
|
10
|
+
"SampleScore",
|
|
11
|
+
"setScoreEditorApp",
|
|
12
|
+
"getScoreEditorApp",
|
|
13
|
+
"openScore",
|
|
14
|
+
"getXmlSamplesDirPath",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
_scoreEditorApp = ""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def setScoreEditorApp(executableFullPath: str) -> None:
|
|
21
|
+
"""Set the full path to the installed score editor app
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
executableFullPath (str): Score editor full path
|
|
25
|
+
Example 01: "C:/path/to/MuseScore"
|
|
26
|
+
Example 02: "/Applications/MuseScore 4.app/Contents/MacOS/mscore"
|
|
27
|
+
|
|
28
|
+
Examples of use:
|
|
29
|
+
|
|
30
|
+
>>> import maialib as ml
|
|
31
|
+
>>> # Example for Windows:
|
|
32
|
+
>>> ml.setScoreEditorApp("C:/path/to/MuseScore.exe")
|
|
33
|
+
>>> # Example for Mac OSX:
|
|
34
|
+
>>> ml.setScoreEditorApp("/Applications/MuseScore 4.app/Contents/MacOS/mscore")
|
|
35
|
+
"""
|
|
36
|
+
global _scoreEditorApp
|
|
37
|
+
|
|
38
|
+
if os.path.isfile(executableFullPath):
|
|
39
|
+
_scoreEditorApp = executableFullPath
|
|
40
|
+
else:
|
|
41
|
+
raise ValueError("Invalid executable full path")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def getScoreEditorApp() -> str:
|
|
45
|
+
global _scoreEditorApp
|
|
46
|
+
return _scoreEditorApp
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def openScore(score: mc.Score) -> None:
|
|
50
|
+
score.toFile("temp")
|
|
51
|
+
global _scoreEditorApp
|
|
52
|
+
|
|
53
|
+
if not _scoreEditorApp:
|
|
54
|
+
raise RuntimeError(
|
|
55
|
+
"Please, set your installed music score editor using the 'setScoreEditorApp' function"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(f"Opening Score Editor App: {_scoreEditorApp}")
|
|
59
|
+
ret = subprocess.Popen([_scoreEditorApp, "temp.xml"])
|
|
60
|
+
ret.wait()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class SampleScore(Enum):
|
|
64
|
+
Bach_Cello_Suite_1 = "Bach_Cello_Suite_1"
|
|
65
|
+
Beethoven_Symphony_5th = "Beethoven_Symphony_5th"
|
|
66
|
+
Chopin_Fantasie_Impromptu = "Chopin_Fantasie_Impromptu"
|
|
67
|
+
Dvorak_Symphony_9_mov_4 = "Dvorak_Symphony_9_mov_4"
|
|
68
|
+
Mahler_Symphony_8_Finale = "Mahler_Symphony_8_Finale"
|
|
69
|
+
Mozart_Requiem_Introitus = "Mozart_Requiem_Introitus"
|
|
70
|
+
Strauss_Also_Sprach_Zarathustra = "Strauss_Also_Sprach_Zarathustra"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def getSampleScorePath(sampleEnum: SampleScore) -> str:
|
|
74
|
+
"""Get a maialib internal XML sample file
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
sampleEnum (SampleScore): Maialib SampleScore enum value
|
|
78
|
+
- Bach_Cello_Suite_1
|
|
79
|
+
- Beethoven_Symphony_5th
|
|
80
|
+
- Chopin_Fantasie_Impromptu
|
|
81
|
+
- Dvorak_Symphony_9_mov_4
|
|
82
|
+
- Mahler_Symphony_8_Finale
|
|
83
|
+
- Mozart_Requiem_Introitus
|
|
84
|
+
- Strauss_Also_Sprach_Zarathustra
|
|
85
|
+
|
|
86
|
+
Kwargs:
|
|
87
|
+
None
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
A full file path (str) to the XML maialib internal sample score
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
RuntimeError
|
|
94
|
+
|
|
95
|
+
Examples of use:
|
|
96
|
+
|
|
97
|
+
>>> import maialib as ml
|
|
98
|
+
>>> filePath = ml.getSampleScorePath(ml.SampleScore.Bach_Cello_Suite_1)
|
|
99
|
+
>>> score = ml.Score(filePath)
|
|
100
|
+
>>> score.info()
|
|
101
|
+
"""
|
|
102
|
+
# Get the actual XML file name for the given 'alias'
|
|
103
|
+
xmlFileName = {
|
|
104
|
+
SampleScore.Bach_Cello_Suite_1: "Bach_Cello_Suite_1.mxl",
|
|
105
|
+
SampleScore.Beethoven_Symphony_5th: "Beethoven_Symphony_5_mov_1.xml",
|
|
106
|
+
SampleScore.Chopin_Fantasie_Impromptu: "Chopin_Fantasie_Impromptu.mxl",
|
|
107
|
+
SampleScore.Dvorak_Symphony_9_mov_4: "Dvorak_Symphony_9_mov_4.mxl",
|
|
108
|
+
SampleScore.Mahler_Symphony_8_Finale: "Mahler_Symphony_8_Finale.mxl",
|
|
109
|
+
SampleScore.Mozart_Requiem_Introitus: "Mozart_Requiem_Introitus.mxl",
|
|
110
|
+
SampleScore.Strauss_Also_Sprach_Zarathustra: "Strauss_Also_Sprach_Zarathustra.mxl",
|
|
111
|
+
}[sampleEnum]
|
|
112
|
+
|
|
113
|
+
# xmlDir = pkg_resources.files("maialib").joinpath("xml-scores-examples")
|
|
114
|
+
xmlDir = ""
|
|
115
|
+
if sys.version_info >= (3, 9):
|
|
116
|
+
from importlib import resources
|
|
117
|
+
|
|
118
|
+
xmlDir = resources.files("maialib").joinpath("xml-scores-examples")
|
|
119
|
+
else:
|
|
120
|
+
from importlib_resources import files
|
|
121
|
+
|
|
122
|
+
xmlDir = files("maialib").joinpath("xml-scores-examples")
|
|
123
|
+
|
|
124
|
+
fileFullPath = os.path.join(xmlDir, xmlFileName)
|
|
125
|
+
return str(fileFullPath)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def getXmlSamplesDirPath() -> str:
|
|
129
|
+
"""Get the maialib XML samples directory path
|
|
130
|
+
|
|
131
|
+
Kwargs:
|
|
132
|
+
None
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
A full dir path (str) to the XML maialib internal samples score directory
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
RuntimeError
|
|
139
|
+
|
|
140
|
+
Examples of use:
|
|
141
|
+
|
|
142
|
+
>>> import maialib as ml
|
|
143
|
+
>>> xmlDir = ml.getXmlSamplesDirPath()
|
|
144
|
+
>>> score = ml.Score(xmlDir + "Bach/cello_suite_1_violin.xml")
|
|
145
|
+
>>> score.info()
|
|
146
|
+
"""
|
|
147
|
+
xmlDir = pkg_resources.files("maialib").joinpath("xml-scores-examples")
|
|
148
|
+
return str(xmlDir)
|
maialib/maiapy/other.pyi
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import maialib.maiacore as mc
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
def setScoreEditorApp(executableFullPath: str) -> None:
|
|
5
|
+
'''Set the full path to the installed score editor app
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
executableFullPath (str): Score editor full path
|
|
9
|
+
Example 01: "C:/path/to/MuseScore"
|
|
10
|
+
Example 02: "/Applications/MuseScore 4.app/Contents/MacOS/mscore"
|
|
11
|
+
|
|
12
|
+
Examples of use:
|
|
13
|
+
|
|
14
|
+
>>> import maialib as ml
|
|
15
|
+
>>> # Example for Windows:
|
|
16
|
+
>>> ml.setScoreEditorApp("C:/path/to/MuseScore.exe")
|
|
17
|
+
>>> # Example for Mac OSX:
|
|
18
|
+
>>> ml.setScoreEditorApp("/Applications/MuseScore 4.app/Contents/MacOS/mscore")
|
|
19
|
+
'''
|
|
20
|
+
def getScoreEditorApp() -> str: ...
|
|
21
|
+
def openScore(score: mc.Score) -> None: ...
|
|
22
|
+
|
|
23
|
+
class SampleScore(Enum):
|
|
24
|
+
Bach_Cello_Suite_1: str
|
|
25
|
+
Beethoven_Symphony_5th: str
|
|
26
|
+
Chopin_Fantasie_Impromptu: str
|
|
27
|
+
Dvorak_Symphony_9_mov_4: str
|
|
28
|
+
Mahler_Symphony_8_Finale: str
|
|
29
|
+
Mozart_Requiem_Introitus: str
|
|
30
|
+
Strauss_Also_Sprach_Zarathustra: str
|
|
31
|
+
|
|
32
|
+
def getSampleScorePath(sampleEnum: SampleScore) -> str:
|
|
33
|
+
"""Get a maialib internal XML sample file
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
sampleEnum (SampleScore): Maialib SampleScore enum value
|
|
37
|
+
- Bach_Cello_Suite_1
|
|
38
|
+
- Beethoven_Symphony_5th
|
|
39
|
+
- Chopin_Fantasie_Impromptu
|
|
40
|
+
- Dvorak_Symphony_9_mov_4
|
|
41
|
+
- Mahler_Symphony_8_Finale
|
|
42
|
+
- Mozart_Requiem_Introitus
|
|
43
|
+
- Strauss_Also_Sprach_Zarathustra
|
|
44
|
+
|
|
45
|
+
Kwargs:
|
|
46
|
+
None
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
A full file path (str) to the XML maialib internal sample score
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
RuntimeError
|
|
53
|
+
|
|
54
|
+
Examples of use:
|
|
55
|
+
|
|
56
|
+
>>> import maialib as ml
|
|
57
|
+
>>> filePath = ml.getSampleScorePath(ml.SampleScore.Bach_Cello_Suite_1)
|
|
58
|
+
>>> score = ml.Score(filePath)
|
|
59
|
+
>>> score.info()
|
|
60
|
+
"""
|
|
61
|
+
def getXmlSamplesDirPath() -> str:
|
|
62
|
+
'''Get the maialib XML samples directory path
|
|
63
|
+
|
|
64
|
+
Kwargs:
|
|
65
|
+
None
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
A full dir path (str) to the XML maialib internal samples score directory
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
RuntimeError
|
|
72
|
+
|
|
73
|
+
Examples of use:
|
|
74
|
+
|
|
75
|
+
>>> import maialib as ml
|
|
76
|
+
>>> xmlDir = ml.getXmlSamplesDirPath()
|
|
77
|
+
>>> score = ml.Score(xmlDir + "Bach/cello_suite_1_violin.xml")
|
|
78
|
+
>>> score.info()
|
|
79
|
+
'''
|